Linear algebra package for Rust with ndarray based on external LAPACK implementations.
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:
sh
cargo run --example solve --features=openblas
and run all tests of ndarray-linalg with OpenBLAS
sh
cargo test --features=openblas
Three BLAS/LAPACK implementations are supported:
gfortran
(or other Fortran compiler)cmake
and gfortran
There are three features corresponding to the backend implementations (openblas
/ netlib
/ intel-mkl
):
toml
[dependencies]
ndarray = "0.12"
ndarray-linalg = { version = "0.11", features = ["openblas"] }
If you creating a library depending on this crate, we encourage you not to link any backend:
toml
[dependencies]
ndarray = "0.12"
ndarray-linalg = "0.11"
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.
```toml [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:
rust
extern crate ndarray;
extern crate ndarray_linalg;
extern crate openblas_src; // or another backend of your choice