Expand description
§tenrso-sparse
Sparse tensor formats and operations for TenRSo.
Version: 0.1.0-alpha.2 Tests: 243 passing (100%) Status: Production-ready with 8 sparse formats and comprehensive operations
This crate provides:
- 8 Sparse Formats: COO, CSR, CSC, BCSR, ELL, DIA, CSF, HiCOO
- 36 Sparse Operations: Element-wise, transcendental, binary operations
- Matrix Factorizations: ILU(0), IC(0) incomplete factorizations
- Iterative Solvers: CG, BiCGSTAB, GMRES with preconditioning
- Matrix Reordering: RCM, AMD for bandwidth/fill-in reduction
- Graph Algorithms: BFS, DFS, connected components, shortest paths
- I/O Support: Matrix Market format read/write
- Visualization: ASCII art sparsity patterns, spy plots
- Parallel Operations: Multi-threaded conversions and computations
§Examples
use tenrso_sparse::{CooTensor, CsrMatrix, io, graph, viz};
// Create a sparse matrix
let indices = vec![vec![0, 0], vec![1, 1], vec![2, 0]];
let values = vec![4.0, 5.0, 3.0];
let shape = vec![3, 3];
let coo = CooTensor::new(indices, values, shape).unwrap();
// Convert to CSR for efficient operations
let csr = CsrMatrix::from_coo(&coo).unwrap();
// Visualize sparsity pattern
println!("{}", viz::ascii_pattern(&csr, 10, 10));
// Use as graph (find connected components)
let components = graph::connected_components(&csr);
// Save to Matrix Market format
let mut buffer = Vec::new();
io::write_matrix_market(&coo, &mut buffer).unwrap();Re-exports§
pub use bcsr::*;pub use coo::*;pub use csc::*;pub use csr::*;pub use dia::*;pub use ell::*;pub use error::*;pub use mask::*;
Modules§
- bcsr
- BCSR (Block Compressed Sparse Row) format
- constructors
- Special matrix constructors for common sparse matrix patterns
- coo
- COO (Coordinate) sparse tensor format
- csc
- CSC (Compressed Sparse Column) format for 2D matrices
- csr
- CSR (Compressed Sparse Row) format for 2D matrices
- dia
- DIA (Diagonal) Sparse Matrix Format
- eigensolvers
- Eigenvalue and eigenvector solvers for sparse matrices
- ell
- ELL (ELLPACK) Sparse Matrix Format
- error
- Unified error types for sparse tensor operations
- factorization
- Sparse matrix factorizations
- graph
- Graph algorithms on sparse matrices
- indexing
- Sparse tensor indexing and slicing operations
- io
- Matrix Market I/O format support
- iterators
- Efficient iterators for sparse tensor traversal
- mask
- Masking support for sparse tensor operations
- masked_
einsum - Masked einsum operations for sparse-dense mixed computation
- norms
- Sparse Tensor Norms
- ops
- Unified sparse tensor operations interface
- parallel
- Parallel sparse tensor format conversions and operations
- patterns
- Sparse Matrix Pattern Analysis
- reductions
- Reduction operations for sparse tensors
- reordering
- Matrix reordering algorithms for sparse matrices
- solvers
- Iterative linear solvers for sparse systems
- structural
- Sparse Tensor Structural Operations
- utils
- Utility functions for sparse tensor operations
- viz
- Sparsity pattern visualization utilities