23

Is there support for sparse matrices in python?

Possibly in numpy or in scipy?

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
user566621
  • 239
  • 1
  • 2
  • 3

2 Answers2

41

Yes.

SciPi provides scipy.sparse, a "2-D sparse matrix package for numeric data".

There are seven available sparse matrix types:

  1. csc_matrix: Compressed Sparse Column format
  2. csr_matrix: Compressed Sparse Row format
  3. bsr_matrix: Block Sparse Row format
  4. lil_matrix: List of Lists format
  5. dok_matrix: Dictionary of Keys format
  6. coo_matrix: COOrdinate format (aka IJV, triplet format)
  7. dia_matrix: DIAgonal format
William Price
  • 4,033
  • 1
  • 35
  • 54
Steve Tjoa
  • 59,122
  • 18
  • 90
  • 101
5
  1. CVXOPT - Sparse matrices

  2. Pysparse

kros
  • 1,257
  • 12
  • 19