spmatrix — SciPy v1.15.2 Manual (original) (raw)

scipy.sparse.

class scipy.sparse.spmatrix[source]#

This class provides a base class for all sparse matrix classes.

It cannot be instantiated. Most of the work is provided by subclasses.

Attributes:

shape

Shape of the matrix

Methods

__mul__(other)
asfptype() Upcast matrix to a floating point format (if necessary)
getH() Return the Hermitian transpose of this matrix.
get_shape() Get the shape of the matrix
getcol(j) Returns a copy of column j of the matrix, as an (m x 1) sparse matrix (column vector).
getformat() Matrix storage format
getmaxprint() Maximum number of elements to display when printed.
getnnz([axis]) Number of stored values, including explicit zeros.
getrow(i) Returns a copy of row i of the matrix, as a (1 x n) sparse matrix (row vector).
set_shape(shape) Set the shape of the matrix in-place
todense([order, out]) Return a dense representation of this sparse matrix.