# Difference between eigs and eig

124 views (last 30 days)
Quantum on 23 Apr 2014
Answered: Walter Roberson on 11 Apr 2016
Hello,
I am unable to understand the eigs function. The documentation states that eigs(A,k,sigma) returns 'k' eigen values/vectors of A closest to 'sigma'.
1. When I call it for different values of 'k', the returned eigenvalues change considerably. For example, my expectation is that eigs(A,3,0) should share 2 eigenvalues returned by eig(A,2,0)
2. Second, the values returned are considerably different from those returned by eig.
Is this behavior expected? I will appreciate if someone could explain.
Thank you.
Best regards

Quantum on 23 Apr 2014
Honestly, it doesn't answer the question.
Thank you.
Geoff Hayes on 23 Apr 2014
Hi Quantum,
The documentation for eigs states that the input matrix A should be square and sparse, and in the Tips section:
d = eigs(A,k) is not a substitute for
d = eig(full(A))
d = sort(d)
d = d(end-k+1:end)
So it is understood that the two may produce different results.
As for your first question, I agree with you that the there should be two shared eigenvalues when k is increased from 2 to 3. I have observed that for a couple of the examples that I tried. Could you post your example (A matrix) where the eigenvalues change considerably?
Geoff

Andrew Knyazev on 15 May 2015
Is this behavior expected?
- Yes. Eigs uses a tricky method that may give the results you describe, especially for funny matrices.

Juan Garcia on 8 Dec 2015
As far as I know the difference is because eigs use iterative methods to calculate ther eigenmodes, being ther error bigger in the last calculated eigenmodes. If you request more eigenmodes, you should check that only the last differ. Regards

Manish Waykole on 11 Apr 2016
If you have checked this then let it pass. I had faced a similar problem, if you are passing the following syntax eigs(A) then it gives largest 6 eigen values by default. To get more of the eigen values use eigs(A,9) *here 9 is an example denoting that you need 9 eigen values arranged in descendin order.
Note: In descending order. All the values are in descending order on contrary to eig command which acc. to my knowledge gives eigen values in ascending order
I have a question, what kind of eigen vector is obtained. I have a input of the form eigs(A,B,5,'sm') implying that I need 5 smallest eigen values. Here as far as I can see the eigen vector generated also has 5 rows so it is incomplete. Incomplete in the sense that I need it(whole of it almost 16 eigen values are present) in my further calculations.

Walter Roberson on 11 Apr 2016