6.3 Sparse Matrix Arithmetic

6.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, int[] v, 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.