OxiBLAS Sparse - Sparse matrix support.
This crate provides sparse matrix formats and operations:
- CSR: Compressed Sparse Row format
- CSC: Compressed Sparse Column format
- COO: Coordinate format (for construction)
- DIA: Diagonal format (for banded matrices)
- ELL: ELLPACK format (for GPU computation)
- BSR: Block Sparse Row format (for block-structured matrices)
- BSC: Block Sparse Column format (for column-oriented block structure)
- HYB: Hybrid ELL+COO format (for irregular sparsity patterns)
- SELL: Sliced ELLPACK format (for GPU-optimized row-variable matrices)
Sparse Matrix Formats
CSR (Compressed Sparse Row)
Efficient for row-wise operations and matrix-vector products. Stores values row by row.
CSC (Compressed Sparse Column)
Efficient for column-wise operations and direct solvers. Stores values column by column.
DIA (Diagonal)
Efficient for banded matrices (tridiagonal, pentadiagonal, etc.). Stores diagonals explicitly.
ELL (ELLPACK)
Efficient for GPU computation with uniform row lengths. Fixed number of entries per row.
BSR (Block Sparse Row)
Efficient for block-structured matrices (FEM, etc.). Stores dense blocks in CSR-like structure.
Example
use ;
// Create a sparse matrix in CSR format
// [1 0 2]
// [0 3 0]
// [4 0 5]
let values = vec!;
let col_indices = vec!;
let row_ptrs = vec!;
let csr = new.unwrap;
assert_eq!;
// Convert to CSC
let csc = csr.to_csc;
assert_eq!;
// Create a tridiagonal matrix in DIA format
let sub = vec!;
let main = vec!;
let super_diag = vec!;
let dia = tridiagonal.unwrap;
assert_eq!;