23

Is there support for sparse matrices in python?

Possibly in numpy or in scipy?

David Heffernan
  • 587,191
  • 41
  • 1,025
  • 1,442
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
  • 3,841
  • 1
  • 34
  • 50
Steve Tjoa
  • 55,811
  • 16
  • 88
  • 98
5
  1. CVXOPT - Sparse matrices

  2. Pysparse

kros
  • 1,247
  • 12
  • 19