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
- Decomposition methods:
- Solution of linear systems:
- Inverse matrix computation
§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.
§Utilities
Modules§
- assert
- Assertions for array
- cholesky
- Cholesky decomposition of Hermitian (or real symmetric) positive definite matrices
- convert
- utilities for convert array
- diagonal
- Vector as a Diagonal matrix
- eig
- Eigenvalue decomposition for non-symmetric square matrices
- eigh
- Eigendecomposition for Hermitian matrices.
- error
- Define Errors
- generate
- Generator functions for matrices
- inner
- krylov
- Krylov subspace methods
- layout
- Convert ndarray into LAPACK-compatible matrix format
- least_
squares - Least Squares
- lobpcg
- norm
- Norm of vectors
- operator
- Linear operator algebra
- opnorm
- Operator norm
- qr
- QR decomposition
- solve
- Solve systems of linear equations and invert matrices
- solveh
- Solve Hermitian (or real symmetric) linear problems and invert Hermitian (or real symmetric) matrices
- svd
- Singular-value decomposition (SVD)
- svddc
- Singular-value decomposition (SVD) by divide-and-conquer (?gesdd)
- trace
- Trace calculation
- triangular
- Methods for triangular matrices
- tridiagonal
- Vectors as a Tridiagonal matrix & Methods for tridiagonal matrices
- types
- Basic types and their methods for linear algebra
Macros§
Structs§
- BKFactorized
- Represents the Bunch–Kaufman factorization of a Hermitian (or real
symmetric) matrix as
A = P * U * D * U^H * P^T. - Cholesky
Factorized - Cholesky decomposition of Hermitian (or real symmetric) positive definite matrix
- Diagonal
- Vector as a Diagonal matrix
- LUFactorized
- Represents the LU factorization of a matrix
AasA = P*L*U. - LUFactorized
Tridiagonal - Represents the LU factorization of a tridiagonal matrix
AasA = P*L*U. - Least
Squares Result - Result of a LeastSquares computation
- Tridiagonal
- Represents a tridiagonal matrix as 3 one-dimensional vectors.
- Truncated
Eig - Truncated eigenproblem solver
- Truncated
Svd - Truncated singular value decomposition
Enums§
- Diag
- Specify whether input triangular matrix is unit or not
- JobSvd
- Specifies how many singular vectors are computed
- Matrix
Layout - Norm
Type - Normalize
Axis - Transpose
- Truncated
Order - Find largest or smallest eigenvalues
- UPLO
- Upper/Lower specification for seveal usages
Traits§
- Allocated
Array - Allocated
Array Mut - AsDiagonal
- Cholesky
- Cholesky decomposition of Hermitian (or real symmetric) positive definite matrix reference
- Cholesky
Inplace - Cholesky decomposition of Hermitian (or real symmetric) positive definite mutable reference of matrix
- Cholesky
Into - Cholesky decomposition of Hermitian (or real symmetric) positive definite matrix
- Determinant
- An interface for calculating determinants of matrix refs.
- DeterminantC
- Determinant of Hermitian (or real symmetric) positive definite matrix ref
- DeterminantC
Into - Determinant of Hermitian (or real symmetric) positive definite matrix
- DeterminantH
- An interface for calculating determinants of Hermitian (or real symmetric) matrix refs.
- DeterminantH
Into - An interface for calculating determinants of Hermitian (or real symmetric) matrices.
- Determinant
Into - An interface for calculating determinants of matrices.
- Determinant
Tridiagonal - An interface for calculating determinants of tridiagonal matrix refs.
- Eig
- Eigenvalue decomposition of general matrix reference
- EigVals
- Calculate eigenvalues without eigenvectors
- EigValsh
- Calculate eigenvalues without eigenvectors
- EigValsh
Inplace - Calculate eigenvalues without eigenvectors
- EigValsh
Into - Calculate eigenvalues without eigenvectors
- Eigh
- Eigenvalue decomposition of Hermite matrix reference
- Eigh
Inplace - Eigenvalue decomposition of mutable reference of Hermite matrix
- Eigh
Into - Eigenvalue decomposition of Hermite matrix
- Extract
Tridiagonal - An interface for making a Tridiagonal struct.
- Factorize
- An interface for computing LU factorizations of matrix refs.
- FactorizeC
- Cholesky decomposition of Hermitian (or real symmetric) positive definite matrix reference
- FactorizeC
Into - Cholesky decomposition of Hermitian (or real symmetric) positive definite matrix
- FactorizeH
- An interface for computing the Bunch–Kaufman factorization of Hermitian (or real symmetric) matrix refs.
- FactorizeH
Into - An interface for computing the Bunch–Kaufman factorization of Hermitian (or real symmetric) matrices.
- Factorize
Into - An interface for computing LU factorizations of matrices.
- Factorize
Tridiagonal - An interface for computing LU factorizations of tridiagonal matrix refs.
- Factorize
Tridiagonal Into - An interface for computing LU factorizations of tridiagonal matrices.
- Inner
Product - Inner Product
- Into
Diagonal - Into
Triangular - Inverse
- An interface for inverting matrix refs.
- InverseC
- Inverse of Hermitian (or real symmetric) positive definite matrix ref
- InverseC
Into - Inverse of Hermitian (or real symmetric) positive definite matrix
- InverseH
- An interface for inverting Hermitian (or real symmetric) matrix refs.
- InverseH
Into - An interface for inverting Hermitian (or real symmetric) matrices.
- Inverse
Into - An interface for inverting matrices.
- Lapack
- Trait for primitive types which implements LAPACK subroutines
- Least
Squares Svd - Solve least squares for immutable references
- Least
Squares SvdIn Place - Solve least squares for mutable references, overwriting the input fields in the process
- Least
Squares SvdInto - Solve least squares for owned matrices
- Linear
Operator - Abstracted linear operator as an action to vector (
ArrayBase<S, Ix1>) and matrix (ArrayBase<S, Ix2) - Norm
- Define norm as a metric linear space (not as a matrix)
- Operation
Norm - Operator norm using
*langeLAPACK routines - QR
- QR decomposition for matrix reference
- QRInto
- QR decomposition
- QRSquare
- QR decomposition for square matrix reference
- QRSquare
Inplace - QR decomposition for mutable reference of square matrix
- QRSquare
Into - QR decomposition for square matrix
- Reciprocal
Condition Num - An interface for estimating the reciprocal condition number of matrix refs.
- Reciprocal
Condition NumInto - An interface for estimating the reciprocal condition number of matrices.
- Reciprocal
Condition NumTridiagonal - An interface for estimating the reciprocal condition number of tridiagonal matrix refs.
- Reciprocal
Condition NumTridiagonal Into - An interface for estimating the reciprocal condition number of tridiagonal matrices.
- SVD
- singular-value decomposition of matrix reference
- SVDDC
- Singular-value decomposition of matrix (copying) by divide-and-conquer
- SVDDC
Inplace - Singular-value decomposition of matrix reference by divide-and-conquer
- SVDDC
Into - Singular-value decomposition of matrix by divide-and-conquer
- SVDInplace
- singular-value decomposition for mutable reference of matrix
- SVDInto
- singular-value decomposition
- Scalar
- Solve
- An interface for solving systems of linear equations.
- SolveC
- Solve systems of linear equations with Hermitian (or real symmetric) positive definite coefficient matrices
- SolveH
- An interface for solving systems of Hermitian (or real symmetric) linear equations.
- Solve
Triangular - solve a triangular system with upper triangular matrix
- Solve
Triangular Inplace - solve a triangular system with upper triangular matrix
- Solve
Triangular Into - solve a triangular system with upper triangular matrix
- Solve
Tridiagonal - Solve
Tridiagonal Inplace - Symmetric
Sqrt - Calculate symmetric square-root matrix using
eigh - Symmetric
Sqrt Into - Calculate symmetric square-root matrix using
eigh - Trace
Functions§
- aclose
- check two values are close in terms of the absolute tolerance
- close_
l1 - check two arrays are close in L1 norm
- close_
l2 - check two arrays are close in L2 norm
- close_
max - check two arrays are close in maximum norm
- conjugate
- Hermite conjugate matrix
- flatten
- from_
diag - construct matrix from diag
- generalize
- hstack
- stack vectors into matrix horizontally
- into_
col - into_
matrix - into_
row - normalize
- normalize in L2 norm
- random
- Generate random array with given shape
- random_
hermite - Random Hermite matrix
- random_
hermite_ using - Random Hermite matrix with given RNG
- random_
hpd - Random Hermite Positive-definite matrix
- random_
hpd_ using - Random Hermite Positive-definite matrix with given RNG
- random_
regular - Generate random regular matrix
- random_
regular_ using - Generate random regular matrix with given RNG
- random_
unitary - Generate random unitary matrix using QR decomposition
- random_
unitary_ using - Generate random unitary matrix using QR decomposition with given RNG
- random_
using - Generate random array with given RNG
- rclose
- check two values are close in terms of the relative tolerance
- replicate
- transpose_
data - vstack
- stack vectors into matrix vertically
Type Aliases§
- Pivot
- c32
- Alias for a
Complex<f32> - c64
- Alias for a
Complex<f64>