Sparse#
This page provides pylibraft class references for the publicly-exposed elements of the pylibraft.sparse.linalg.eigsh package.
- pylibraft.sparse.linalg.eigsh(
- A,
- k=6,
- which='LM',
- v0=None,
- ncv=None,
- maxiter=None,
- tol=0,
- seed=None,
- handle=None,
Find
keigenvalues and eigenvectors of the real symmetric square matrix or complex Hermitian matrixA.Solves
Ax = wx, the standard eigenvalue problem forweigenvalues with corresponding eigenvectorsx.- Args:
- a (spmatrix): A symmetric square sparse CSR matrix with
dimension
(n, n).amust be of typecupyx.scipy.sparse._csr.csr_matrix- k (int): The number of eigenvalues and eigenvectors to compute. Must be
1 <= k < n.- which (str): ‘LM’ or ‘LA’ or ‘SA’.
‘LM’: finds
klargest (in magnitude) eigenvalues. ‘LA’: findsklargest (algebraic) eigenvalues. ‘SA’: findsksmallest (algebraic) eigenvalues. ‘SM’: findsksmallest (in magnitude) eigenvalues.- v0 (ndarray): Starting vector for iteration. If
None, a random unit vector is used.
- ncv (int): The number of Lanczos vectors generated. Must be
k + 1 < ncv < n. IfNone, 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||. If0, machine precision is used.
- Returns:
- tuple:
It returns
wandxwherewis eigenvalues andxis eigenvectors.
See also
scipy.sparse.linalg.eigsh()cupyx.scipy.sparse.linalg.eigsh()Note
This function uses the thick-restart Lanczos methods (https://sdm.lbl.gov/~kewu/ps/trlan.html).