Reputation: 21
The compute method of Selfadjointeigensolver() method of Eigen library computes the eigen vectors of all the eigen values. I want to make it calculate eigen vector of only one specific eigen value e.g the smallest or the 5th from smallest. Is this possible ?
Upvotes: 2
Views: 2834
Reputation: 506
If your matrix is real and you are already using Eigen, the simplest is to use Spectra, which is a header only library that only requires Eigen. It's a redesign of old Arpack, which uses Arnoldi power iteration to iteratively converge towards extremal eigenvalue/eigenvector pairs. You can ask for "a few" eigenpairs at a time.
If your matrix is complex you have two options. Either you go for Arpack++ directly which can handle complex matrices but is more tedious to use OR you can insist on Spectra by splitting the matrix into real and imaginary parts as explained here, but this comes with a large performance penalty. Essentially, if you have a complex N*N
matrix A=B+iC
and vector x=u+iv
you turn the eigenvalue equation Ax=kx
into (B+iC)(u+iv)=k(u+iv)
, which can be written as a 2N*2N
problem.
If your matrix is truly large you may want to consider Slepc.
Upvotes: 1