Expand description

The ndarray-linalg crate provides linear algebra functionalities for ArrayBase, the n-dimensional array data structure provided by ndarray.

ndarray-linalg leverages LAPACK’s routines using the bindings provided by blas-lapack-rs/lapack.

Linear algebra methods

Naming Convention

Each routine is usually exposed as a trait, implemented by the relevant types.

For each routine there might be multiple “variants”: different traits corresponding to the different ownership possibilities of the array you intend to work on.

For example, if you are interested in the QR decomposition of a square matrix, you can use:

  • QRSquare, if you hold an immutable reference (i.e. &self) to the matrix you want to decompose;
  • QRSquareInplace, if you hold a mutable reference (i.e. &mut self) to the matrix you want to decompose;
  • QRSquareInto, if you can pass the matrix you want to decompose by value (e.g. self).

Depending on the algorithm, each variant might require more or less copy operations of the underlying data.

Details are provided in the description of each routine.



pub use crate::assert::*;
pub use crate::cholesky::*;
pub use crate::convert::*;
pub use crate::diagonal::*;
pub use crate::eig::*;
pub use crate::eigh::*;
pub use crate::generate::*;
pub use crate::inner::*;
pub use crate::layout::*;
pub use crate::least_squares::*;
pub use crate::norm::*;
pub use crate::operator::*;
pub use crate::opnorm::*;
pub use crate::qr::*;
pub use crate::solve::*;
pub use crate::solveh::*;
pub use crate::svd::*;
pub use crate::svddc::*;
pub use crate::trace::*;
pub use crate::triangular::*;
pub use crate::tridiagonal::*;
pub use crate::types::*;


Assertions for array

Cholesky decomposition of Hermitian (or real symmetric) positive definite matrices

utilities for convert array

Vector as a Diagonal matrix

Eigenvalue decomposition for non-symmetric square matrices

Eigendecomposition for Hermitian matrices.

Define Errors

Generator functions for matrices

Krylov subspace methods

Convert ndarray into LAPACK-compatible matrix format

Least Squares

Norm of vectors

Linear operator algebra

Operator norm

QR decomposition

Solve systems of linear equations and invert matrices

Solve Hermitian (or real symmetric) linear problems and invert Hermitian (or real symmetric) matrices

Singular-value decomposition (SVD)

Singular-value decomposition (SVD) by divide-and-conquer (?gesdd)

Trace calculation

Methods for triangular matrices

Vectors as a Tridiagonal matrix & Methods for tridiagonal matrices

Basic types and their methods for linear algebra



Truncated eigenproblem solver

Truncated singular value decomposition


Find largest or smallest eigenvalues