Find one eigenvector

268 views Asked by At

Suppose I have a really large (symmetric) matrix M of size N by N and I just want to extract one eigenvector corresponding to one eigenvalue. Is there a way to do this without finding all the eigenvectors. One way I thought of doing this is to first find the eigenvalues (which is fast) and then solve for one eigenvector.

E = np.linalg.eigvalsh(M)
e = E[N/2]
v = np.linalg.solve(E-np.diag([e]*N), 0)

But of course you can guess that the solution of this is just v=0. I could do an SVD decomposition of M-eI but I this seems to slower than just computing all the eigenvectors of M.

1

There are 1 answers

3
eickenberg On

You can use

from scipy.sparse.linalg import eigs

Take a look at the docstring - there is a parameter k that sets how many eigenvalues and vectors are to be calculated. If I recall correctly, this is done by an iterative scheme from ARPACK. So make sure you set tol to an appropriate value for your application.