eigs function: incorrect eigenvectors
4 views (last 30 days)
Show older comments
I am using eigs to find largest 330 eigenvalues, the eigenvalues converges and found pretty match with eig (full (my matrix)), But the eigen vectors didn't match well, it is showing completely new eigen vector. What is the problem? here is my matrix, please?
my matrix= sparse size: 456 x 456
here is the code: [V D]=eigs(M4,330,'la');
for full matrix,
[V1 D1]=eig(full(M4));
thanks in advance.
0 Comments
Answers (3)
Ced
on 22 Oct 2014
Edited: Ced
on 22 Oct 2014
One thing to notice is that eigs orders the eigenvalues (and vectors) in descending order, while eig has them in ascending order.
Then, I believe there are simply numerical problems here. If you check e.g.
norm(M4*V1(:,1)-D1(1,1)*V1(:,1))
, which should be zero by definition, is not.
If you try the code you have above for e.g. M4 = randn(5,5), you will see that eig and eigs return both the same eigenvalues and eigenvectors. The error in direction is of magnitude 1e-15, which is numerically zero, but is huge if you have eigenvalues of the magnitude of 1e30, as is the case with M4.
Cheers
Andrew Knyazev
on 15 May 2015
This is normal for eigs. If you are happy with eig, just stay with it.
Mark Stone
on 15 May 2015
Edited: Mark Stone
on 15 May 2015
If you like your eig, you can keep your eig. No one will be forced to switch their eigenvalue/vector provider to eigs if they're happy with their eig.
As I wrote in another thread:
eigs does not always converge, even if maximum number of iterations is significantly increased and/or solution tolerance decreased. Furthermore, it is random, i.e., non-repeatable, even on the exact same matrix unless random numbers are controlled to be the same at invocation.
eig is much more robust than eigs, and execution time of eigs is more unpredictable than eig, and can be longer. I've run nonlinear optimization algorithms in which eigenvalues (maybe the most extreme 1 or 2) appear in the objective function and/or constraints - even though the algorithm might start and finish (if it ever gets there) in a nice neighborhood in which eigs works just fine, the algorithm might have to go through some unseemly areas along the way, and eigs has a propensity for getting into trouble somewhere and muck everything up. I've rendered eigs to the ash heap of history after wasting too much time dealing with its nonsense. Someone should shoot it and put it out of the misery it causes.
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!