Skip to main content

transpose_sparse

Function transpose_sparse 

Source
pub fn transpose_sparse<T, U>(
    sparse_data: &CompressedSparseData2<T, U>,
) -> CompressedSparseData2<T, U>
Expand description

Re-express a compressed sparse matrix in the other format (CSC→CSR or CSR→CSC).

Despite the name this does not transpose: shape is carried over unchanged and only cs_type flips, so the result addresses the same elements by the same (row, col) pair. Reach for CompressedSparseData2::transpose_and_convert when the shape is meant to swap.

A counting sort in O(nnz) time. Above PARALLEL_TRANSPOSE_MIN_NNZ the count and the scatter both fan out over rayon: the scatter is a random-write pass over nnz-sized destinations, so leaving it single-threaded makes it the slowest step of anything that converts on the way in.

§Params

  • sparse_data: The input compressed sparse matrix to be converted.

§Returns

The same matrix in the other compressed sparse format, with shape unchanged and the indices of each new major run ascending.