Skip to main content

csr_vecmat

Function csr_vecmat 

Source
pub fn csr_vecmat<T>(
    vec: &[T],
    mat: &CompressedSparseData2<T>,
) -> Result<Vec<T>, SparseErrors>
where T: BixverseNumeric,
Expand description

Dense vector @ sparse matrix: v @ M.

Computes result[j] = sum_i v[i] * M[i, j] by iterating CSR rows of M and scattering scaled row contributions into the output. Treats v as a row vector.

§Params

  • vec - Dense vector of length m.
  • mat - CSR matrix of shape (m, n).

§Returns

Dense vector of length n. Errors if mat is not CSR.