bug fix in lina_eig

This commit is contained in:
Francesco Cozzuto
2023-03-28 10:54:01 +02:00
parent 8347422cf7
commit 43eb0ab212
+1 -1
View File
@@ -893,7 +893,7 @@ bool lina_eig(double *M, double complex *E, int n)
// The current diagonal entry is A[i*n + i],
// so if this is the first entry of a 2x2 block,
// its lower entry A[(i+1)*n + i] will be non-zero
if (fabs(A[(i+1) * n + i]) > eps) {
if (i+1 < n && fabs(A[(i+1) * n + i]) > eps) {
// It's a 2x2 block. Unpack the complex eigenvalues
// using the quadratic formula. (Is there a better