I'm not an expert on this, but I would start out trying the methods in the LinearAlgebra stdlib. The LinearAlgebra.eigen
function is specialized on the input matrix types SymTridiagonal, Hermitian, Symmetric
, and lets you specify how many vectors/values you want:
If you have a dense matrix, A
, and want the largest r
eigenvalues and vectors:
(evals, evecs) = eigen(Symmetric(A), 1:r)
You can also use eigvals
and eigvecs
if you just need eigenvalues or eigenvectors. Also check out eigen!
if you want to save some memory.
BTW, using Symmetric(A)
doesn't create a new matrix, it is just a wrapper around A
that tells the compiler that A
is symmetrical and only accesses the part of A
that is above the diagonal.
If the version in LinearAlgebra
is not the fastest in this quite general case, then it should probably be reported on Julia's github. There may be faster implementations for more specialized cases, but for general symmetric dense matrices, the implementation in the stdlib should be expected to be near optimal.