CSR matrices

Many operations in PARALLAX rely on sparse matrices, which are stored using the Compressed Sparse Row (CSR) format with one-based indexing. The csrmat_t type has the following attributes:

  • ndim: Number of rows.
  • ncol: Number of columns.
  • nnz: Number of non-zero elements.
  • i: The row pointer (one-based indexing, dimension = ndim + 1).
  • j: Column indices (one-based indexing, dimension = nnz).
  • vals: Values of the matrix elements (dimension = nnz).

There are also routines available to perform common sparse matrix-vector operations, as well as to sort (and sum duplicates of) entries in ascending order of column index for each row.