Module linalg

Module linalg 

Source
Expand description

linear algebra module

contains low level routines and the implementation of their corresponding high level wrappers

§memory allocation

since most faer crates aim to expose a low level api for optimal performance, most algorithms try to defer memory allocation to the user

however, since a lot of algorithms need some form of temporary space for intermediate computations, they may ask for a slice of memory for that purpose, by taking a stack: MemStack parameter. a MemStack is a thin wrapper over a slice of memory bytes. this memory may come from any valid source (heap allocation, fixed-size array on the stack, etc.). the functions taking a MemStack parameter have a corresponding function with a similar name ending in _scratch that returns the memory requirements of the algorithm. for example: householder::apply_block_householder_on_the_left_in_place_with_conj and householder::apply_block_householder_on_the_left_in_place_scratch

the memory stack may be reused in user-code to avoid repeated allocations, and it is also possible to compute the sum (dyn_stack::StackReq::all_of) or union (dyn_stack::StackReq::any_of) of multiple scratch requirements, in order to optimally combine them into a single allocation

after computing a dyn_stack::StackReq, one can query its size and alignment to allocate the required memory. the simplest way to do so is through dyn_stack::MemBuffer::new

Modules§

cholesky
low level implementation of the various cholesky-like decompositions
evd
low level implementation of the eigenvalue decomposition of a square diagonalizable matrix.
householder
block householder transformations
jacobi
jacobi rotation matrix
kron
kronecker product
lu
low level implementation of the various $LU$ decompositions
matmul
matrix multiplication
qr
faer provides utilities for computing and manipulating the $QR$ factorization with and without pivoting. the $QR$ factorization decomposes a matrix into a product of a unitary matrix $Q$ (represented using block householder sequences), and an upper trapezoidal matrix $R$, such that their product is equal to the original matrix (or a column permutation of it in the case where column pivoting is used)
solvers
high level solvers
svd
low level implementation of the svd of a matrix
triangular_inverse
triangular matrix inverse
triangular_solve
triangular matrix solve Triangular solve module.
zip
matrix zipping implementation

Functions§

temp_mat_scratch
returns the stack requirements for creating a temporary matrix with the given dimensions.
temp_mat_uninit
creates a temporary matrix of uninit values, from the given memory stack.
temp_mat_zeroed
creates a temporary matrix of zero values, from the given memory stack.