spmatrix#
- class scipy.sparse.spmatrix[source]#
This class provides a base class for all sparse matrix classes.
Warning
SciPy sparse is shifting from a sparse matrix interface to a sparse array interface. In the next few releases we expect to deprecate the sparse matrix interface. For documentation of the matrix interface, see the spmatrix interface docs. For guidance on converting existing code to sparse arrays, see Migration from spmatrix to sparray.
This class also serves as the namespace for SciPy sparse matrix types. It cannot be instantiated. Most of the work is provided by subclasses.
- Attributes:
shapeShape of the matrix
Methods
__mul__(other)__pow__(power)asfptype()Upcast matrix to a floating point format (if necessary)
getH()Return the Hermitian transpose of this matrix.
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).
Matrix storage format
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.
__rmul__