Sparse

Contents

Sparse#

2025-10-17

2 min read time

Applies to Linux

This page provides pylibraft class references for the publicly-exposed elements of the pylibraft.sparse.linalg.eigsh package.

linalg.lanczos.eigsh(*args, handle=None, **kwargs)#

eigsh(A, k=6, v0=None, ncv=None, maxiter=None, tol=0, seed=None, handle=None)

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