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, v0=None, ncv=None, maxiter=None, tol=0, seed=None, handle=None)[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.

Args:
a (spmatrix): A symmetric square sparse CSR matrix with

dimension (n, n). a must be of type cupyx.scipy.sparse._csr.csr_matrix

k (int): The number of eigenvalues and eigenvectors to compute. Must be

1 <= k < n.

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

Returns:
tuple:

It returns w and x where w is eigenvalues and x is 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).