cupyx.scipy.sparse.linalg.eigsh(a, k=6, *, which='LM', ncv=None, maxiter=None, tol=0, return_eigenvectors=True)[source]#

Find k eigenvalues and eigenvectors of the real symmetric square matrix or complex Hermitian matrix A.

Solves Ax = wx, the standard eigenvalue problem for w eigenvalues with corresponding eigenvectors x.

  • a (ndarray, spmatrix or LinearOperator) – A symmetric square matrix with dimension (n, n). a must cupy.ndarray, cupyx.scipy.sparse.spmatrix or cupyx.scipy.sparse.linalg.LinearOperator.

  • k (int) – The number of eigenvalues and eigenvectors to compute. Must be 1 <= k < n.

  • which (str) – ‘LM’ or ‘LA’. ‘LM’: finds k largest (in magnitude) eigenvalues. ‘LA’: finds k largest (algebraic) eigenvalues. ‘SA’: finds k smallest (algebraic) eigenvalues.

  • ncv (int) – The number of Lanczos vectors generated. Must be k + 1 < ncv < n. If None, default value is used.

  • maxiter (int) – Maximum number of Lanczos update iterations. If None, default value is used.

  • tol (float) – Tolerance for residuals ||Ax - wx||. If 0, machine precision is used.

  • return_eigenvectors (bool) – If True, returns eigenvectors in addition to eigenvalues.


If return_eigenvectors is True, it returns w and x where w is eigenvalues and x is eigenvectors. Otherwise, it returns only w.

Return type:



This function uses the thick-restart Lanczos methods (