Skip to main content

Module sparse

Module sparse 

Source
Expand description

Sparse matrix formats, sparse operations and helpers to transform different formats into each other. Free of any dense linear algebra dependency.

Structs§

CompressedSparseData2
Structure to store compressed sparse data with two potential data layers. Think for example in single cell raw counts and normalised counts.
ScatterPtr
Destination pointer handed to every worker of the parallel scatter.
SparseAxis
Generate structure to store sparse rows or columns

Enums§

CompressedSparseFormat
Type to describe the CompressedSparseFormat

Functions§

coo_to_csr
Transform COO stored data into CSR
coo_to_csr_presorted
Optimised COO to CSR - assumes input is already sorted by (row, col)
csr_matmul_csr
Multiply two CSR matrices using sparse accumulators and parallel processing
csr_matvec
Sparse matrix @ dense vector: M @ v.
csr_vecmat
Dense vector @ sparse matrix: v @ M.
eliminate_zeros_csr
Remove zeros from sparse matrix
normalise_csr_columns_l1
Normalises the columns of a CSR matrix to a sum of 1 (L1 norm)
normalise_csr_rows_l1
Normalises the rows of a CSR matrix to a sum of 1 (L1 norm)
parse_compressed_sparse_format
Helper function to parse compressed sparse format
require_csc
Fail unless the matrix is stored as CSC.
require_csr
Fail unless the matrix is stored as CSR.
require_matmul_operands
Check that two CSR matrices can be multiplied, a @ b.
sparse_add_csr
Add two CSR matrices together
sparse_multiply_elementwise_csr
Element-wise sparse multiplication
sparse_scalar_multiply_csr
Scalar multiplication of CSR matrix
sparse_subtract_csr
Sparse matrix subtraction
thread_chunks
Split 0..n into one contiguous range per rayon worker.
transpose_sparse
Re-express a compressed sparse matrix in the other format (CSC→CSR or CSR→CSC).
transpose_sparse_single_layer
Transpose a compressed sparse matrix (CSC→CSR or CSR→CSC), keeping only one of the two data layers.
undirected_edges_to_csr
Scatter a sorted undirected edge list into a symmetric CSR adjacency
validate_square_csr
Check that a matrix is a structurally sound square CSR and return its order