Sparse matrix

CuPy supports sparse matrices using cuSPARSE. These matrices have the same interfaces of SciPy’s sparse matrices.

Sparse matrix classes

cupy.sparse.coo_matrix COOrdinate format sparse matrix.
cupy.sparse.csr_matrix Compressed Sparse Row matrix.
cupy.sparse.csc_matrix Compressed Sparse Column matrix.
cupy.sparse.dia_matrix Sparse matrix with DIAgonal storage.
cupy.sparse.spmatrix Base class of all sparse matrixes.

Functions

Building sparse matrices

cupy.sparse.eye Creates a sparse matrix with ones on diagonal.
cupy.sparse.identity Creates an identity matrix in sparse format.

Identifying sparse matrices

cupy.sparse.issparse Checks if a given matrix is a sparse matrix.
cupy.sparse.isspmatrix Checks if a given matrix is a sparse matrix.
cupy.sparse.isspmatrix_csc Checks if a given matrix is of CSC format.
cupy.sparse.isspmatrix_csr Checks if a given matrix is of CSR format.
cupy.sparse.isspmatrix_coo Checks if a given matrix is of COO format.
cupy.sparse.isspmatrix_dia Checks if a given matrix is of DIA format.