Function sprs::smmp::symbolic

source ·
pub fn symbolic<Iptr: SpIndex, I: SpIndex>(
    a: CsStructureViewI<'_, I, Iptr>,
    b: CsStructureViewI<'_, I, Iptr>,
    c_indptr: &mut [Iptr],
    c_indices: &mut Vec<I>,
    seen: &mut [bool]
)
Expand description

Compute the symbolic structure of the matrix product C = A * B, with A, B and C stored in the CSR matrix format.

This algorithm has a complexity of O(n * k * log(k)), where k is the average number of nonzeros in the rows of the result.

Panics

index.len() should be equal to the maximum dimension among the input matrices.

The matrices should be in proper CSR structure, and their dimensions should be compatible. Failures to do so may result in out of bounds errors (though some cases might go unnoticed).

Minimizing allocations

This function will reserve a_indptr.last().unwrap() + b_indptr.last.unwrap() in c_indices. Therefore, to prevent this function from allocating, it is required to have reserved at least this amount of memory.