Attention
The vector search and clustering algorithms in RAFT are being migrated to a new library dedicated to vector search called cuVS. We will continue to support the vector search algorithms in RAFT during this move, but will no longer update them after the RAPIDS 24.06 (June) release. We plan to complete the migration by RAPIDS 24.10 (October) release and they will be removed from RAFT altogether in the 24.12 (December) release.
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)[source]#
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).