Crate ndarray_linalg

Crate ndarray_linalg 

Source
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.

§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§

assert_aclose
assert_close_l1
assert_close_l2
assert_close_max
assert_rclose

Structs§

BKFactorized
Represents the Bunch–Kaufman factorization of a Hermitian (or real symmetric) matrix as A = P * U * D * U^H * P^T.
CholeskyFactorized
Cholesky decomposition of Hermitian (or real symmetric) positive definite matrix
Diagonal
Vector as a Diagonal matrix
LUFactorized
Represents the LU factorization of a matrix A as A = P*L*U.
LUFactorizedTridiagonal
Represents the LU factorization of a tridiagonal matrix A as A = P*L*U.
LeastSquaresResult
Result of a LeastSquares computation
Tridiagonal
Represents a tridiagonal matrix as 3 one-dimensional vectors.
TruncatedEig
Truncated eigenproblem solver
TruncatedSvd
Truncated singular value decomposition

Enums§

Diag
Specify whether input triangular matrix is unit or not
JobSvd
Specifies how many singular vectors are computed
MatrixLayout
NormType
NormalizeAxis
Transpose
TruncatedOrder
Find largest or smallest eigenvalues
UPLO
Upper/Lower specification for seveal usages

Traits§

AllocatedArray
AllocatedArrayMut
AsDiagonal
Cholesky
Cholesky decomposition of Hermitian (or real symmetric) positive definite matrix reference
CholeskyInplace
Cholesky decomposition of Hermitian (or real symmetric) positive definite mutable reference of matrix
CholeskyInto
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
DeterminantCInto
Determinant of Hermitian (or real symmetric) positive definite matrix
DeterminantH
An interface for calculating determinants of Hermitian (or real symmetric) matrix refs.
DeterminantHInto
An interface for calculating determinants of Hermitian (or real symmetric) matrices.
DeterminantInto
An interface for calculating determinants of matrices.
DeterminantTridiagonal
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
EigValshInplace
Calculate eigenvalues without eigenvectors
EigValshInto
Calculate eigenvalues without eigenvectors
Eigh
Eigenvalue decomposition of Hermite matrix reference
EighInplace
Eigenvalue decomposition of mutable reference of Hermite matrix
EighInto
Eigenvalue decomposition of Hermite matrix
ExtractTridiagonal
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
FactorizeCInto
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.
FactorizeHInto
An interface for computing the Bunch–Kaufman factorization of Hermitian (or real symmetric) matrices.
FactorizeInto
An interface for computing LU factorizations of matrices.
FactorizeTridiagonal
An interface for computing LU factorizations of tridiagonal matrix refs.
FactorizeTridiagonalInto
An interface for computing LU factorizations of tridiagonal matrices.
InnerProduct
Inner Product
IntoDiagonal
IntoTriangular
Inverse
An interface for inverting matrix refs.
InverseC
Inverse of Hermitian (or real symmetric) positive definite matrix ref
InverseCInto
Inverse of Hermitian (or real symmetric) positive definite matrix
InverseH
An interface for inverting Hermitian (or real symmetric) matrix refs.
InverseHInto
An interface for inverting Hermitian (or real symmetric) matrices.
InverseInto
An interface for inverting matrices.
Lapack
Trait for primitive types which implements LAPACK subroutines
LeastSquaresSvd
Solve least squares for immutable references
LeastSquaresSvdInPlace
Solve least squares for mutable references, overwriting the input fields in the process
LeastSquaresSvdInto
Solve least squares for owned matrices
LinearOperator
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)
OperationNorm
Operator norm using *lange LAPACK routines
QR
QR decomposition for matrix reference
QRInto
QR decomposition
QRSquare
QR decomposition for square matrix reference
QRSquareInplace
QR decomposition for mutable reference of square matrix
QRSquareInto
QR decomposition for square matrix
ReciprocalConditionNum
An interface for estimating the reciprocal condition number of matrix refs.
ReciprocalConditionNumInto
An interface for estimating the reciprocal condition number of matrices.
ReciprocalConditionNumTridiagonal
An interface for estimating the reciprocal condition number of tridiagonal matrix refs.
ReciprocalConditionNumTridiagonalInto
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
SVDDCInplace
Singular-value decomposition of matrix reference by divide-and-conquer
SVDDCInto
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.
SolveTriangular
solve a triangular system with upper triangular matrix
SolveTriangularInplace
solve a triangular system with upper triangular matrix
SolveTriangularInto
solve a triangular system with upper triangular matrix
SolveTridiagonal
SolveTridiagonalInplace
SymmetricSqrt
Calculate symmetric square-root matrix using eigh
SymmetricSqrtInto
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>