I wish to ask what libraries for sparse matrices satisfy the following criteria:

(1) Is very efficient (memory and time wise). Uses vectorization (mandatory) and parallelization (not mandatory, but desirable). My matrices can have dimensions 10^7 x 10^7 or more, with a few entries per column on average (i.e. between 10^7 and 10^9 nonzero entries). Matrix entries are exact, either integers or fractions (I work over rings Z, Z_(p) and fields Z_p, Q).

(2) The matrices can be in CSR or CSC format and can be converted into LIL format.

(3) The following (basic) methods must be implemented:

  • Matrix multiplication: a.b
  • Entry-wise multiplication a*b
  • Matrix transpose: a^t
  • Apply any function (such as mod integers by an integer or take numerators of fractions or invert fractions) on all nonzero matrix values.
  • Let I be a subset of row-indices and J a subset of column-indices. Return submatrices a[I,], a[,J], a[I,J]
  • Set all entries in I-rows or J-columns to 0, i.e. a[I,]=0 or a[,J]=0.
  • For a vector w of the same length as I, multiply the I-rows in a by the numbers from w, i.e. a[I,]=w*a[I,], so we multiply all nonzero entries in the I[0] row by w[0], and so on.
  • For a subset of locations IJ={(i0,j0),...}, set the entries at the IJ-locations in a to be 0, i.e. a[IJ]=0.
  • Remove zero entries in a. Sort the entries in CSR format. In Python scipy.sparse, we have these two functions for this.

I currently have no need for other linear algebra operations, the focus is on efficiency (RAM shortages are my trouble) and coefficients (rarely can I find rational coefficients).

I've googled a bit and found NewMat, Eigen, LinBox, BLAS, LAPACK, ATLAS, SuiteSparse, uBLAS, Armadillo, blaze, CSPARSE, Trilino, ..., but I have never used those libraries. Do they satisfy all the above conditions? Which is the most efficient (benchmark comparisons are welcome)? Are there any better libraries?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.