Vector Algebra |
|
template<typename T > |
| void | fill (const T f, Vector< T > &x) |
| | fill vector with constant
|
|
template<typename T > |
| void | conj (Vector< T > &x) |
| | conjugate entries in vector
|
|
template<typename T > |
| void | scale (const T f, Vector< T > &x) |
| | scale vector by constant
|
|
template<typename T > |
| void | copy (const Vector< T > &x, Vector< T > &y) |
| | copy x into y
|
|
template<typename T > |
| void | swap (Vector< T > &x, Vector< T > &y) |
| | exchange x and y
|
|
template<typename T > |
| idx_t | max_idx (const Vector< T > &x) |
| | determine index with maximal absolute value in x
|
|
template<typename T > |
| idx_t | min_idx (const Vector< T > &x) |
| | determine index with minimax absolute value in x
|
|
template<typename T > |
| void | add (const T alpha, const Vector< T > &x, Vector< T > &y) |
| | compute y ≔ y + α·x
|
|
template<typename T > |
| T | dot (const Vector< T > &x, const Vector< T > &y) |
| | compute <x,y> = x^H · y
|
|
template<typename T > |
| T | dotu (const Vector< T > &x, const Vector< T > &y) |
| | compute <x,y> without conjugating x, e.g. x^T · y
|
|
template<typename T > |
| num_traits< T >::real_t | norm2 (const Vector< T > &x) |
| | compute ∥x∥₂
|
|
template<typename T > |
| bool | abs_lt (const T a1, const T a2) |
| template<typename T > |
| T | stable_dotu (const Vector< T > &x, const Vector< T > &y) |
| | compute dot product x · y numerically stable
|
| template<typename T > |
| T | stable_sum (const Vector< T > &x) |
| | compute sum of elements in x numerically stable
|
Basic Matrix Algebra |
|
template<typename T > |
| void | fill (const T f, Matrix< T > &M) |
| | set M to f entrywise
|
|
template<typename T > |
| void | conj (Matrix< T > &M) |
| | conjugate entries in vector
|
|
template<typename T > |
| void | scale (const T f, Matrix< T > &M) |
| | compute M ≔ f · M
|
|
template<typename T_value , typename T_derived > |
| void | copy (const MatrixBase< T_derived > &A, Matrix< T_value > &B) |
| | copy A to B
|
|
template<typename T > |
| void | transpose (Matrix< T > &A) |
| | transpose matrix A: A → A^T ASSUMPTION: A is square matrix
|
|
template<typename T > |
| void | conj_transpose (Matrix< T > &A) |
| | conjugate transpose matrix A: A → A^H ASSUMPTION: A is square matrix
|
|
template<typename T > |
| void | max_idx (const Matrix< T > &M, idx_t &row, idx_t &col) |
| | determine index (i,j) with maximal absolute value in M and return in row and col
|
|
template<typename T > |
| void | add (const T f, const Matrix< T > &A, Matrix< T > &B) |
| | compute B = B + f A
|
|
template<typename T > |
| void | add_r1 (const T alpha, const Vector< T > &x, const Vector< T > &y, Matrix< T > &A) |
| | compute A ≔ A + α·x·y^H
|
|
template<typename T_value , typename T_derived > |
| void | mulvec (const T_value alpha, const MatrixBase< T_derived > &A, const Vector< T_value > &x, const T_value beta, Vector< T_value > &y) |
| | compute y ≔ β·y + α·A·x
|
|
template<typename T_value , typename T_derived > |
| void | mulvec_tri (const tri_type_t shape, const diag_type_t diag, const MatrixBase< T_derived > &A, Vector< T_value > &x) |
| | compute x ≔ M·x, where M is upper or lower triangular with unit or non-unit diagonal
|
|
template<typename T_value , typename T_derived_A , typename T_derived_B > |
| void | prod (const T_value alpha, const MatrixBase< T_derived_A > &A, const MatrixBase< T_derived_B > &B, const T_value beta, Matrix< T_value > &C) |
| | compute C ≔ β·C + α·A·B
|
|
template<typename T_derived_A , typename T_derived_B > |
| void | hadamard_prod (const MatrixBase< T_derived_A > &A, MatrixBase< T_derived_B > &B) |
| | compute B ≔ A⊙B, e.g. Hadamard product
|
|
template<typename T_value , typename T_derived > |
| void | prod_tri (const eval_side_t side, const tri_type_t uplo, const diag_type_t diag, const T_value alpha, const MatrixBase< T_derived > &A, Matrix< T_value > &B) |
| | compute B ≔ α·A·B or B ≔ α·B·A
|
|
template<typename T > |
| void | prod_diag (Matrix< T > &M, const Vector< typename num_traits< T >::real_t > &D, const idx_t k) |
| | multiply k columns of M with diagonal matrix D, e.g. compute M ≔ M·D
|
|
template<typename T > |
| num_traits< T >::real_t | norm2 (const Matrix< T > &M) |
| | return spectral norm of M
|
|
template<typename T > |
| num_traits< T >::real_t | normF (const Matrix< T > &M) |
| | return Frobenius norm of M
|
|
template<typename T > |
| num_traits< T >::real_t | normF (const Matrix< T > &A, const Matrix< T > &B) |
| | compute Frobenius norm of A-B
|
| template<typename T > |
| num_traits< T >::real_t | cond (const Matrix< T > &M) |
| | return condition of M
|
|
template<typename T > |
| void | make_symmetric (Matrix< T > &A) |
| | make given matrix symmetric, e.g. copy lower left part to upper right part
|
|
template<typename T > |
| void | make_hermitian (Matrix< T > &A) |
| | make given matrix hermitian, e.g. copy conjugated lower left part to upper right part and make diagonal real
|
|
template<typename T_value , typename T_derived > |
| void | add (const T_value f, const MatrixBase< T_derived > &A, Matrix< T_value > &B) |
Advanced Matrix Algebra |
|
template<typename T > |
| void | solve (Matrix< T > &A, Matrix< T > &B) |
| | solve A·X = B with known A and B; X overwrites B
|
|
template<typename T_value , typename T_derived > |
| void | solve_tri (const tri_type_t uplo, const diag_type_t diag, const MatrixBase< T_derived > &A, Vector< T_value > &b) |
| | solve A·x = b with known A and b; x overwrites b
|
|
template<typename T_value , typename T_derived > |
| void | solve_tri (const eval_side_t side, const tri_type_t uplo, const diag_type_t diag, const T_value alpha, const MatrixBase< T_derived > &A, Matrix< T_value > &B) |
| | solve A·X = α·B or X·A· = α·B with known A and B; X overwrites B
|
|
template<typename T > |
| void | invert (Matrix< T > &A) |
| | invert matrix A; A will be overwritten with A^-1 upon exit
|
|
template<typename T > |
| void | invert (Matrix< T > &A, const tri_type_t tri_type, const diag_type_t diag_type) |
| | invert lower or upper triangular matrix A with unit or non-unit diagonal; A will be overwritten with A^-1 upon exit
|
|
template<typename T > |
| void | lu (Matrix< T > &A) |
| | compute LU factorisation of the n×m matrix A with n×min(n,m) unit diagonal lower triangular matrix L and min(n,m)xm upper triangular matrix U; A will be overwritten with L and U upon exit
|
|
template<typename T > |
| void | llt (Matrix< T > &A) |
| | compute L·L^T factorisation of given symmetric n×n matrix A
|
|
template<typename T > |
| void | llh (Matrix< T > &A) |
| | compute L·L^H factorisation of given hermitian n×n matrix A
|
|
template<typename T > |
| void | ldlt (Matrix< T > &A) |
| | compute L·D·L^T factorisation of given symmetric n×n matrix A
|
|
template<typename T > |
| void | ldlh (Matrix< T > &A) |
| | compute L·D·L^H factorisation of given hermitian n×n matrix A
|
|
template<typename T > |
| void | qr (Matrix< T > &A, Matrix< T > &R) |
| | compute QR factorisation of the n×m matrix A with n×m matrix Q and mxm matrix R (n >= m); A will be overwritten with Q upon exit
|
|
template<typename T > |
| void | eigen (Matrix< T > &M, Vector< T > &eig_val, Matrix< T > &eig_vec) |
| | compute eigenvalues and eigenvectors of matrix M
|
| template<typename T > |
| void | eigen (Matrix< T > &M, const Range &eig_range, Vector< T > &eig_val, Matrix< T > &eig_vec) |
| | compute selected (by eig_range) eigenvalues and eigenvectors of the symmetric matrix M
|
|
template<typename T > |
| void | eigen (Vector< T > &diag, Vector< T > &subdiag, Vector< T > &eig_val, Matrix< T > &eig_vec) |
| | compute eigenvalues and eigenvectors of the symmetric, tridiagonal matrix defines by diagonal coefficients in diag and off-diagonal coefficients subdiag
|
|
template<typename T > |
| void | svd (Matrix< T > &A, Vector< typename num_traits< T >::real_t > &S, Matrix< T > &V) |
| | compute SVD decomposition of the nxm matrix A with n×min(n,m) matrix U, min(n,m)×min(n,m) matrix S (diagonal) and m×min(n,m) matrix V; A will be overwritten with U upon exit
|
|
template<typename T > |
| void | svd (Matrix< T > &A, Vector< typename num_traits< T >::real_t > &S, const bool left=true) |
| | compute SVD decomposition of the nxm matrix A but return only the left/right singular vectors and the singular values S ∈ ℝ^min(n,m); upon exit, A will be contain the corresponding sing. vectors
|
|
template<typename T > |
| void | sv (Matrix< T > &A, Vector< typename num_traits< T >::real_t > &S) |
| | compute SVD decomposition of the nxm matrix A but return only the singular values S ∈ ℝ^min(n,m); A will be overwritten with U upon exit
|
|
template<typename T > |
| void | sv (Matrix< T > &A, Matrix< T > &B, Vector< typename num_traits< T >::real_t > &S) |
| | compute SVD decomposition of the nxm low-rank matrix M but return only the singular values S ∈ ℝ^min(n,m); A and B will be overwritten upon exit
|
|
template<typename T > |
| size_t | approx (Matrix< T > &M, const TTruncAcc &acc, Matrix< T > &A, Matrix< T > &B) |
| | approximate given dense matrix M by low rank matrix according to accuracy acc. The low rank matrix will be stored in A and B
|
|
template<typename T > |
| size_t | truncate (Matrix< T > &A, Matrix< T > &B, const TTruncAcc &acc) |
| | truncate given A · B^H low rank matrix matrix (A being n×k and B being m×k) with respect to given accuracy acc; store truncated matrix in A(:,0:k-1) and B(:,0:k-1) where k is the returned new rank after truncation
|
| template<typename T > |
| void | factorise_ortho (Matrix< T > &A, Matrix< T > &R) |
| | construct factorisation A = Q·R of A, with orthonormal Q
|
| template<typename T > |
| void | factorise_ortho (Matrix< T > &A, Matrix< T > &R, const TTruncAcc &acc) |
| | construct approximate factorisation A = Q·R of A, with orthonormal Q
|
This modules provides most low level algebra functions, e.g. vector dot products, matrix multiplication, factorisation and singular value decomposition. See also BLAS/LAPACK Interface for an introduction.
to your source files.