### Bug in Matlab's Eig and lapack's dgeev

Posted:

**Thu Mar 28, 2013 8:40 pm**I have found that in some of my restarted Krylov programs a bug in the Matlab Eig command is causing significant problems. With help from Mark Embree, Dan Sorensen and Charles Puelz, it appears that the bug comes from LAPACK's dgeev. Apparently from posts on the topic "Non-eigenvectors from DGEEV", something is already known of this bug, but I am getting problems routinely, instead of for a "nasty little matrix". As the program proceeds, some eigenvectors become very accurate. This causes very small entries in the lower triangular portion of the H matrix that Eig is applied to. Then some of the eigenvectors start losing accuracy and can become very inaccurate. I have been dealing with the problem by "locking in" eigenvectors (zeroing part of H), but this can cause loss of accuracy for eigenvalues still converging if applied too soon.

Mark Embree has simplified it to this matrix which shows the problem well:

A = [1 1 0 0; 0 2 1 0; 0 0 3 1; eps^2 0 0 4], where eps is machine epsilon.

Eig gives one inaccurate eigenvector for this matrix. Also, if eps^2 is replaced with eps^4, there are two inaccurate eigenvectors. So very small perturbations cause very bad results.

In Matlab, using 'nobalance' seems to fix the problem, as does using schur before eig. Using hess does not always work. However, even though there are options to fix it, it seems that Matlab and LAPACK would want this problem eliminated.

Thanks,

Ron Morgan

Mark Embree has simplified it to this matrix which shows the problem well:

A = [1 1 0 0; 0 2 1 0; 0 0 3 1; eps^2 0 0 4], where eps is machine epsilon.

Eig gives one inaccurate eigenvector for this matrix. Also, if eps^2 is replaced with eps^4, there are two inaccurate eigenvectors. So very small perturbations cause very bad results.

In Matlab, using 'nobalance' seems to fix the problem, as does using schur before eig. Using hess does not always work. However, even though there are options to fix it, it seems that Matlab and LAPACK would want this problem eliminated.

Thanks,

Ron Morgan