# cupyx.scipy.sparse.linalg.eigsh¶

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

Finds `k` eigenvalues and eigenvectors of the real symmetric matrix.

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

Parameters
• 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.

• 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.

Returns

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

tuple

Note

This function uses the thick-restart Lanczos methods (https://sdm.lbl.gov/~kewu/ps/trlan.html).