Strange thing with eigs()


#1

I am currently using v0.6. I was trying to find the k-largest eigenvalues. I encountered a strange issue when I tested eigs for a simple case.

a = [0.3 0.0; 0.0 0.7]
eigs(a)

Apparently, the eigenvalues are 0.3 and 0.7. However, I received the following output

WARNING: Adjusting nev from 6 to 1
([0.7], [0.0; 1.0], 1, 1, 2, [0.0, 0.0])

Of course, eigs(a,2) does not help at all. Is it a bug in Julia or did I miss anything? Thanks.


#2

You want eigvals:

julia> eigvals(a)
2-element Array{Float64,1}:
 0.3
 0.7

eigvals uses standard LAPACK routines, and computes the full eigendecomposition. eigs uses an iterative method (Arnoldi or Lanczos iterations) which only finds the most “significant” eigenvalues (largest/smallest by various measures).