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.

Structs§

BlockLanczosParams
Parameters for the block thick-restart Lanczos eigensolver.
CompressedSparseData2
Structure to store compressed sparse data with two potential data layers. Think for example in single cell raw counts and normalised counts.
LanczosParams
Parameters for the restarted Lanczos eigensolver.
LanczosResult
Outcome of a restarted Lanczos solve, with the convergence diagnostics.
RitzPairs
Ritz pairs and convergence diagnostics from [lanczos_thick_restart] and block_lanczos_thick_restart.
ScatterPtr
Destination pointer handed to every worker of the parallel scatter.
SparseAxis
Generate structure to store sparse rows or columns
SparseColMoments
One sparse column reduced to what sparse_pairwise_correlations needs.

Enums§

CompressedSparseFormat
Type to describe the CompressedSparseFormat

Traits§

SparseFromDense
Builds a CompressedSparseData2 from a dense faer matrix.

Functions§

block_lanczos_thick_restart
Largest eigenpairs of a symmetric operator via block thick-restarted Lanczos.
compute_largest_eigenpairs_lanczos
Compute the largest eigenpairs of a symmetric sparse matrix.
compute_largest_eigenpairs_lanczos_diag
Compute the largest eigenpairs of a symmetric sparse matrix, with diagnostics.
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)
count_zeroes
Counts the zeroes in a given faer matrix
csr_matmul_csr
Multiply two CSR matrices using sparse accumulators and parallel processing
csr_matmul_dense_block
Apply a CSR operator to a dense row-major block: out = a @ block
csr_matvec
Sparse matrix @ dense vector: M @ v.
csr_sparse_matmul_dense
Sparse CSR @ sparse CSR -> dense
csr_vecmat
Dense vector @ sparse matrix: v @ M.
eliminate_zeros_csr
Remove zeros from sparse matrix
frobenius_norm
Compute Frobenius norm of sparse matrix
frobenius_norm_sq_f64
Squared Frobenius norm of a sparse matrix, in f64.
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_col_means_csc
Calculate the column means for CSC CompressedSparseData2
sparse_col_moments
Reduce one sparse column to its moments without densifying it.
sparse_col_sds_csc
Calculate the column standard deviations for CSC CompressedSparseData2
sparse_multiply_elementwise_csr
Element-wise sparse multiplication
sparse_pairwise_correlations
Pearson correlation of specified column pairs, over the sparsity patterns.
sparse_scalar_multiply_csr
Scalar multiplication of CSR matrix
sparse_subtract_csr
Sparse matrix subtraction
sparse_svd_lanczos
Compute sparse SVD using Lanczos on A^T A or AA^T
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