ferrolearn-sparse
Sparse matrix types for the ferrolearn machine learning framework.
Formats
| Type | Description |
|---|---|
CsrMatrix<T> |
Compressed Sparse Row — efficient for row slicing and matrix-vector products |
CscMatrix<T> |
Compressed Sparse Column — efficient for column slicing and transpose products |
CooMatrix<T> |
Coordinate (triplet) format — convenient for incremental construction |
All formats support:
- Conversion between formats and to/from dense
ndarray::Array2<T> - Scalar multiplication and element-wise addition
- Matrix-vector multiplication
CsrMatriximplements theferrolearn_core::Datasettrait
Backed by the sprs crate.
Example
use ;
// Build in COO format, then convert to CSR
let mut coo = new;
coo.push;
coo.push;
coo.push;
let csr = from_coo.unwrap;
let dense = csr.to_dense;
assert_eq!;
assert_eq!;
License
Licensed under either of Apache License, Version 2.0 or MIT License at your option.