7.3 Sparse matrix arithmetic

7.3.1 Sparse matrix multiplication

The only supported operation is the multiplication of a sparse matrix \(A\) and a dense vector \(b\) to produce a dense vector \(A\,b\). Multiplying a dense row vector \(b\) and a sparse matrix \(A\) can be coded using transposition as \[ b \, A = (A^{\top} \, b^{\top})^{\top}, \] but care must be taken to represent \(A^{\top}\) rather than \(A\) as a sparse matrix.

vector csr_matrix_times_vector(int m, int n, vector w, array[] int v, array[] int u, vector b)
Multiply the \(\text{m} \times \text{n}\) matrix represented by values w, column indices v, and row start indices u by the vector b; see compressed row storage.
Available since 2.18