Reputation: 239
Is there support for sparse matrices in python?
Possibly in numpy or in scipy?
Upvotes: 23
Views: 28223
Reputation: 61044
Yes.
SciPi provides scipy.sparse, a "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
Upvotes: 41