#matrix #tensor #mdarray #linear-algebra

mdarray-linalg

Linear algebra operations for mdarray, with multiple exchangeable backends

3 releases

Uses new Rust 2024

0.1.2 Nov 5, 2025
0.1.1 Oct 24, 2025
0.1.0 Oct 24, 2025

#278 in Math

Download history 370/week @ 2025-10-22 10/week @ 2025-11-05 15/week @ 2025-11-12 153/week @ 2025-11-19 449/week @ 2025-11-26 216/week @ 2025-12-03 1427/week @ 2025-12-10

2,105 downloads per month
Used in 5 crates

MIT AND Apache-2.0

105KB
2K SLoC

mdarray-linalg: linear algebra bindings for Rust mdarray

Efficient, flexible, and idiomatic linear algebra bindings (BLAS, LAPACK, etc.) to the Rust mdarray crate.

Usage

These crates are released on crates.io:

cargo add mdarray-linalg

and if you need a backend:

cargo add mdarray-linalg-blas 

Important notes:

  • Use the latest version of mdarray.
  • When using the BLAS backend, include openblas-src to avoid linkage errors
  • When running doctests with Blas or Lapack, linking issues may occur due to this Rust issue: rust-lang/rust#125657. In that case, run the doctests with: RUSTDOCFLAGS="-L native=/usr/lib -C link-arg=-lopenblas" cargo test --doc

If you encounter linking issues with BLAS or LAPACK on Linux, one solution is to add a build.rs file and configure it to link the libraries manually. In your Cargo.toml, add:

[package]
build = "build.rs"

Then, create a build.rs file with the following content:

fn main() {
    println!("cargo:rustc-link-lib=openblas");
    println!("cargo:rustc-link-search=native=/usr/lib");
}

See docs.rs documentation for code examples and usage instructions.

License

Dual-licensed (Apache and MIT) to be compatible with the Rust project. See the file LICENSE.md in this directory.

Dependencies

~1.5–2MB
~41K SLoC