libmat-rs 0.1.1

Rust bindings for libmat, an stb-style single-header linear algebra library in pure C
Documentation
  • Coverage
  • 89.47%
    17 out of 19 items documented1 out of 17 items with examples
  • Size
  • Source code size: 321.75 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 349.7 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 15s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • alvgaona/libmat-rs
    0 0 3
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • alvgaona

libmat-rs

Rust bindings for libmat, an stb-style single-header linear algebra library in pure C.

Usage

Add to your Cargo.toml:

[dependencies]
libmat-rs = "0.1"
use libmat_rs::Mat;

let a = Mat::from_slice(2, 2, &[1.0, 2.0, 3.0, 4.0]);
let b = Mat::eye(2);
let c = a.mul(&b);

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