libmat-rs
Rust bindings for libmat, an stb-style single-header linear algebra library in pure C.
Usage
Add to your Cargo.toml:
[]
= "0.1"
use Mat;
let a = from_slice;
let b = eye;
let c = a.mul;
let eig = a.eigen_sym;
Matrices use column-major storage (BLAS-compatible).
API
| Function | Description |
|---|---|
Mat::new(rows, cols) |
Zero-initialized matrix |
Mat::from_slice(rows, cols, data) |
Matrix from column-major slice |
Mat::eye(dim) |
Identity matrix |
mat.mul(other) |
Matrix multiplication |
mat.add(other) |
Element-wise addition |
mat.at(row, col) |
Element access |
mat.eigvals() |
Eigenvalues (general) |
mat.eigvals_sym() |
Eigenvalues (symmetric) |
mat.eigen() |
Eigendecomposition (general) |
mat.eigen_sym() |
Eigendecomposition (symmetric) |
Coverage
This crate exposes a subset of libmat's functionality. The underlying C library supports many more operations (SVD, Cholesky, QR, LU, solvers, norms, SIMD kernels, etc.) that are not yet wrapped. Contributions are welcome.
License
Apache-2.0