Search code examples
matlabeigenvectoreigenvalue

Search only for the first (couple of) eigenvalue and eigenvector of a matrix - MATLAB


I would like to solve an eigenvalue problem for a PDE by a finite difference method. Therefore my problem is reduced to a matrix eigenvalue problem. The thing is that the size of this matrix will be quite large, and if I use the function eig it searches for ALL the eigenvalues and eigenvectors, which in my case is a waste of time.

Is there a possibility to make the eigenvalue algorithm stop after finding the first k eigenvalues? (where k is a small positive integer)


Solution

  • Yes, use eigs to return the K largest or smallest eigenvalues.

    Example: eigs(A,[],K) will return the K largest-magnitude eigenvectors of matrix A.