eigs function: incorrect eigenvalues

19 vues (au cours des 30 derniers jours)
Dmitry Kopelevich
Dmitry Kopelevich le 9 Mai 2019
I am trying to use the function eigs to obtain several eigenvalues of the smallest magnitude of a singular sparse matrix. This funciton correctly obtaines the zero egienvalue and the corresponding eigenvector, but all non-zero eigenvalues are different from those obtained using the function eig. Moreover, calling eigs several times in a row produces different non-zero eigenvalues. I tried decreasing the tolerance and increasing the number of Lanczos vectors, but that didn't help.
I am attaching a mat file with the matrix. The code that I used for testing is below:
load('test.mat'); % this loads matrix A
[V,D] = eigs(A,5,0);
[V1,D1] = eig(full(A));
  7 commentaires
Dmitry Kopelevich
Dmitry Kopelevich le 10 Mai 2019
Thanks for pointing it out. Unfortunately, this method is applicable only to Hermitian matrices. The matrices I need to analyze are not Hermitian.
Dmitry Kopelevich
Dmitry Kopelevich le 10 Mai 2019
I have just tried applying eigs to a large matrix that I need to analyze (not the test matrix I've uploaded earlier) and it does seem to work reliably. The eigenvalues are reproducible and the eigenvalue/eigenector pairs satisfy the eigenvalue equaiton. It is strange because my test case was essentially a scaled-down version of the matrix that I needed to analyze. But I am glad that it worked!

Connectez-vous pour commenter.

Réponses (1)

Christine Tobler
Christine Tobler le 13 Mai 2019
The problem is that the matrix A is badly conditioned:
>> cond(full(A))
ans =
2.206837183464466e+16
This is just around the border of when EIGS (or even MLDIVIDE) would give a warning about the matrix being ill-conditioned. It doesn't happen to give that warning, but the results still come out wrong (I'll investigate exactly why the warning isn't given here).
The reason for the wrong results here is that for a sigma shift, EIGS operates on the inverse of (A - sigma*I): It computes the largest eigenvalues in absolute value of A\x instead of using A*x, and then inverts those eigenvalues to return the eigenvalues of A. But when A is ill-conditioned, A\x doesn't apply the inverse of a in exact arithmetic, because of round-off error.
Unfortunately, there isn't anything that will make this always come out right. For your particular matrix, I've found that moving the shift slightly to the right will make the matrix (A-sigma*I) be better conditioned, and give the correct eigenvalues:
eigs(A, 5, 1e-4)
Another thing that works for this matrix is to request the largest eigenvalues by real value instead of the ones closest to zero (which happen to be the same ones for this matrix):
eigs(A, 5, 'largestreal')
  1 commentaire
Dmitry Kopelevich
Dmitry Kopelevich le 22 Mai 2019
Thank you for the suggestion. For this particular type of matrices, 'largestreal' works well, since their eigenvales have to have non-positive real parts. (These matrices arise in a finite-difference scheme for a convection-diffusion operator which cannot have eigenvalues with positive real parts.)

Connectez-vous pour commenter.

Catégories

En savoir plus sur Linear Algebra dans Help Center et File Exchange

Produits


Version

R2015a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by