Yes there is, scipy.sparse.linalg.eigsh
, the h
at the end standing for Hermitian, there is also a version for non-symmetrical matrices, scipy.sparse.linalg.eigs
.
If a
is your matrix, sparse or not, your call would look something like:
evals, evecs = scipy.sparse.linalg.eigsh(a, k=1)
Your evals
and evecs
are arrays of eigenvalues and corresponding eigenvectors, since you could ask for more than one if setting k
to something other than 1. Which eigenvalues and vectors are returned is controlled with the which
parameter, that defaults to LM
, standing for largest magnitude.