Skip to main content

Module sparse

Module sparse 

Source
Expand description

Sparse matrix formats and representations.

Format selection is workload-dependent:

  • CSR is the baseline for irregular sparsity with compact zero-copy storage.
  • SELL-p groups rows into const-generic row slices and is best when rows have similar non-zero counts, because padding overhead stays bounded and the vectorized path can load one slice lane per row.
  • Blocked COO is suited to locally dense block structure; const block dimensions monomorphize the inner block loops without a runtime format switch.
  • Dense-with-mask keeps dense row-major values plus a boolean structural mask; it is useful when the dense layout is already required by a caller, but it is memory-bound for low non-zero densities because it stores every value and mask bit.

crates/hermes-simd-benches/benches/sparse_bench.rs records the empirical crossover data. Its scalability sweep varies row count and structural non-zero density while keeping values borrowed at the kernel boundary.

Re-exports§

pub use cow::CowFormat;
pub use cow::OwnedBlockedCoo;
pub use cow::OwnedCsr;
pub use cow::OwnedDenseWithMask;
pub use cow::OwnedSellP;
pub use cow::SparseCow;
pub use ops::SparseOps;
pub use spmv::SparseSpMv;
pub use types::BlockedCooData;
pub use types::CsrData;
pub use types::DenseWithMaskData;
pub use types::SellPData;
pub use types::SparseShape;
pub use types::ValidatedData;
pub use view::SparseView;
pub use view::SparseViewShape;

Modules§

cow
Clone-on-Write sparse matrix containers.
ops
Elementwise operations and value sum/accumulate helpers.
spmv
Sparse matrix-vector multiplication (SpMV) kernels.
types
Concrete data structures for sparse matrix formats.
view
Format-parameterized sparse matrix views.

Structs§

BlockedCoo
Blocked COO format marker.
Csr
Compressed Sparse Row format marker.
DenseWithMask
Dense storage with a boolean mask indicating non-zero elements.
SellP
Sliced ELLPACK format marker.
Validated
Typestate marker for sparse formats whose structural invariants were checked before kernel entry.

Traits§

SparseFormat
Marker trait for sparse matrix storage formats.