#ndarray #lapack #matrix

ndarray-linalg

Linear algebra package for rust-ndarray using LAPACK

27 releases

✓ Uses Rust 2018 edition

0.11.1 Jun 11, 2019
0.10.0 Sep 1, 2018
0.9.0 Jan 12, 2018
0.8.0 Dec 20, 2017
0.1.5 Nov 28, 2016

#46 in Algorithms

Download history 32/week @ 2019-03-31 125/week @ 2019-04-07 23/week @ 2019-04-14 48/week @ 2019-04-21 35/week @ 2019-04-28 66/week @ 2019-05-05 53/week @ 2019-05-12 111/week @ 2019-05-19 237/week @ 2019-05-26 118/week @ 2019-06-02 141/week @ 2019-06-09 216/week @ 2019-06-16 256/week @ 2019-06-23 174/week @ 2019-06-30 95/week @ 2019-07-07

461 downloads per month
Used in 14 crates (11 directly)

MIT license

115KB
2.5K SLoC

ndarray-linalg

Crate docs.rs Build Status

Linear algebra package for Rust with ndarray based on external LAPACK implementations.

Examples

See examples directory.

Note: To run examples, you must specify which backend will be used (as described below). For example, you can execute the solve example with the OpenBLAS backend like this:

cargo run --example solve --features=openblas

and run all tests of ndarray-linalg with OpenBLAS

cargo test --features=openblas

BLAS/LAPACK Backend

Three BLAS/LAPACK implementations are supported:

  • OpenBLAS
    • needs gfortran (or other Fortran compiler)
  • Netlib
    • needs cmake and gfortran
  • Intel MKL (non-free license, see the linked page)

There are three features corresponding to the backend implementations (openblas / netlib / intel-mkl):

[dependencies]
ndarray = "0.12"
ndarray-linalg = { version = "0.11", features = ["openblas"] }

Tested Environments

Backend Linux Windows macOS
OpenBLAS ✔️ 🚫 🚫
Netlib ✔️ 🚫 🚫
Intel MKL ✔️ ✔️ ✔️

For librarian

If you creating a library depending on this crate, we encourage you not to link any backend:

[dependencies]
ndarray = "0.12"
ndarray-linalg = "0.11"

Link backend crate manually

For the sake of linking flexibility, you can provide LAPACKE implementation (as an extern crate) yourself. You should link a LAPACKE implementation to a final crate (like binary executable or dylib) only, not to a Rust library.

[dependencies]
ndarray = "0.12"
ndarray-linalg = "0.11"
openblas-src = "0.7" # or another backend of your choice

You must add extern crate to your code in this case:

extern crate ndarray;
extern crate ndarray_linalg;
extern crate openblas_src; // or another backend of your choice

Dependencies

~4–21MB
~480K SLoC