eigs function: incorrect eigenvalues
21 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Christine Tobler
il 13 Mag 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')
Vedere anche
Categorie
Scopri di più su Linear Algebra in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!