1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! Trueno Sparse: Sparse matrix formats and operations
//!
//! Provides CSR, COO, and BSR sparse matrix formats with SIMD-accelerated
//! SpMV (sparse matrix-vector multiply) and SpMM (sparse matrix-dense matrix multiply).
//!
//! # Design
//!
//! - **Provable contracts**: Format invariants validated at construction time
//! - **Backward error bounded**: Numerical accuracy follows LAProof bounds
//! - **SIMD dispatch**: Scalar → AVX2 → AVX-512 runtime selection
//! - **GPU ready**: Formats are GPU-transfer-friendly (contiguous arrays)
//!
//! # Quick Start
//!
//! ```
//! use trueno_sparse::{CsrMatrix, CooMatrix, SparseOps};
//!
//! // Build from COO (triplets)
//! let coo = CooMatrix::new(3, 3, vec![0, 1, 2], vec![0, 1, 2], vec![1.0_f32, 2.0, 3.0]).unwrap();
//! let csr = CsrMatrix::from_coo(&coo);
//!
//! // SpMV: y = A * x
//! let x = vec![1.0_f32, 1.0, 1.0];
//! let mut y = vec![0.0_f32; 3];
//! csr.spmv(1.0, &x, 0.0, &mut y);
//! assert!((y[0] - 1.0).abs() < 1e-6);
//! assert!((y[1] - 2.0).abs() < 1e-6);
//! assert!((y[2] - 3.0).abs() < 1e-6);
//! ```
//!
//! # References
//!
//! - Merrill & Garland, "Merge-Based Parallel SpMV", PPoPP 2016
//! - LAProof (Princeton): formal backward error bounds for CSR SpMV
pub use BsrMatrix;
pub use CooMatrix;
pub use CsrMatrix;
pub use SparseError;
pub use Avx2Backend;
pub use NeonBackend;
pub use ;
pub use SellMatrix;
pub use spgemm;
pub use validate_csr_invariants;