Skip to main content

transpose_sparse_single_layer

Function transpose_sparse_single_layer 

Source
pub fn transpose_sparse_single_layer<T, U>(
    sparse_data: &CompressedSparseData2<T, U>,
    use_second_layer: bool,
) -> Result<CompressedSparseData2<T, U>, SparseErrors>
Expand description

Transpose a compressed sparse matrix (CSC→CSR or CSR→CSC), keeping only one of the two data layers.

Useful when the caller knows the other layer is dead weight (e.g. raw counts when only normalised counts are consumed downstream). Skips the scatter for the unused layer entirely.

§Params

  • sparse_data - The input compressed sparse matrix to be transposed.
  • use_second_layer - If true, only data_2 is transposed and the output’s data is empty. If false, only data is transposed and the output’s data_2 is None.

§Returns

The transposed compressed sparse matrix with only the requested layer populated.