scipy.sparse Matrix
Jump to navigation
Jump to search
A scipy.sparse Matrix is a sparse matrix data structure that is a scipy Data Structure.
- Context:
- It can range from being a scipy.sparse.csr_matrix, to being a scipy.sparse.csc_matrix; to being a scipy.sparse.lil_matrix ...
- Example(s):
from scipy.sparse import csr_matrix, issparse, isspmatrix, isspmatrix_csc, isspmatrix_csr, isspmatrix_bsr, isspmatrix_lil, isspmatrix_dok, isspmatrix_coo, isspmatrix_dia ;
import numpy as np ;
sprsRowMatrix = sparse.csr_matrix(np.array([[1,2,0], [0,0,3], [1,0,4]])) ;
from scipy import int8 ;
sprsRowMatrixInt8 = csr_matrix(sprsRowMatrix, dtype=int8) ;
- Counter-Example(s):
- See: sklearn.
References
2013
- http://docs.scipy.org/doc/scipy-0.14.0/reference/sparse.html#
- SciPy 2-D sparse matrix package for numeric data.
...
There are seven available sparse matrix types:
- csc_matrix: Compressed Sparse Column format
- csr_matrix: Compressed Sparse Row format
- bsr_matrix: Block Sparse Row format
- lil_matrix: List of Lists format
- dok_matrix: Dictionary of Keys format
- coo_matrix: COOrdinate format (aka IJV, triplet format)
- dia_matrix: DIAgonal format
- SciPy 2-D sparse matrix package for numeric data.