Expand description
Dense complex linear algebra for the small matrices of MIMO processing.
The matrices of a MIMO link are a few antennas wide, so the routines here favour
simplicity and accuracy over asymptotic speed: modified Gram–Schmidt with
re-orthogonalisation for the QR decomposition, Cholesky for Hermitian positive
definite systems, and the one-sided Jacobi method (Hestenes) for the singular value
decomposition, which is accurate to the relative precision of the singular values.
Matrices are ndarray::Array2<C64> (CMat).
§Model
qr: $A = Q R$ with $Q^{H} Q = I$ and $R$ upper triangular with a real, non-negative diagonal ($A$ is $m \times n$, $m \ge n$);cholesky: $A = L L^{H}$ with $L$ lower triangular ($A$ Hermitian positive definite), and the systems ofsolve_hpd, or ofsolve_choleskywith the factor computed once;svd: $A = U \Sigma V^{H}$ with the singular values in decreasing order;solve_tridiagonal: a tridiagonal system by the Thomas algorithm.
§Examples
use comnum_math::linalg::{matmul, hermitian, svd};
use comnum_math::C64;
use ndarray::array;
let a = array![[C64::new(1.0, 1.0), C64::new(0.5, 0.0)], [C64::new(0.0, -2.0), C64::new(1.0, 0.0)]];
let (u, s, v) = svd(&a.view());
// U Σ V^H rebuilds A
let mut us = u.clone();
for (j, sj) in s.iter().enumerate() {
us.column_mut(j).mapv_inplace(|x| x * *sj);
}
let b = matmul(&us.view(), &hermitian(&v.view()).view());
assert!(a.iter().zip(b.iter()).all(|(x, y)| (x - y).norm() < 1e-12));§References
- G. H. Golub and C. F. Van Loan, Matrix Computations, 4th ed., Johns Hopkins University Press, 2013 (Sec. 5.2, 4.2, 8.6).
Functions§
- cholesky
- The Cholesky factor $L$ of a Hermitian positive definite matrix, $A = L L^{H}$.
- gram
- The Gram matrix $A^{H} A$.
- hermitian
- The conjugate transpose $A^{H}$.
- identity
- The identity of size
n. - inverse_
hpd - The inverse of a Hermitian positive definite matrix.
- log2_
det_ hpd - $\log_{2} \det A$ of a Hermitian positive definite matrix.
- matmul
- The product $A B$.
- matvec
- The product $A x$ of a matrix and a vector.
- qr
- The thin QR decomposition $A = Q R$ of an $m \times n$ matrix, $m \ge n$.
- solve_
cholesky - Solve $L L^{H} X = B$ from the Cholesky factor $L$ of
cholesky(forward, then backward substitution):solve_hpdwith the factor computed once, for systems that share the matrix. - solve_
hpd - Solve $A X = B$ for a Hermitian positive definite $A$ (by Cholesky).
- solve_
tridiagonal - The solution of the tridiagonal system
lower[i] u[i-1] + diag[i] u[i] + upper[i] u[i+1] = rhs[i](lower[0]and the lastupperunused), by the Thomas algorithm without pivoting: for diagonally dominant systems, as those of cubic splines. - svd
- The thin singular value decomposition $A = U \Sigma V^{H}$ by one-sided Jacobi.
Type Aliases§
- CMat
- A dense complex matrix.