Expand description
Complex-valued linear algebra implemented entirely in-house (no external backend), for EM / quantum and other complex-domain work.
This crate builds on the storage pattern of tpt_math_linalg_dense and
extends it to a Complex scalar, providing:
ComplexDVector/ComplexDMatrix— dynamically-sized complex vectors and matrices stored column-major.ComplexDMatrix::lu— partial-pivot complex LU factorisation withComplexDMatrix::solve/ComplexDMatrix::inverse.ComplexDMatrix::cholesky— Cholesky factorisation of a Hermitian positive-definite matrix, withCholesky::solve.ComplexDMatrix::eigenvalues— a shifted-QR eigenvalue solver for general complex matrices.
Like tpt_math_linalg_dense, the storage is hand-rolled (a plain
Vec<Complex<T>>), so there is no faer/nalgebra dependency and no
license exposure.
§Features
std(default) — enable the allocator and thestdsupport of deps.alloc— signal allocator availability (dynamic vectors need it).
§Examples
use tpt_math_linalg_complex::{Complex, ComplexDMatrix};
let a = ComplexDMatrix::from_real_row_slice(
2, 2,
&[1.0_f64, 2.0, 3.0, 4.0],
);
let inv = a.inverse().unwrap();
let prod = a.clone() * inv;
assert!((prod[(0, 0)].re - 1.0).abs() < 1e-12);
assert!((prod[(1, 1)].re - 1.0).abs() < 1e-12);
let z = Complex::new(0.0, 1.0);
assert_eq!(z * z, Complex::new(-1.0, 0.0));Structs§
- Cholesky
- A Cholesky factorisation
A = L Lᴴof a Hermitian positive-definite complex matrix. - Complex
- A complex number
z = re + i·imwith real and imaginary parts of typeT. - ComplexD
Matrix - A dynamically-sized complex matrix, stored column-major in a contiguous
Vec((i, j)lives ati + j * nrows). - ComplexD
Vector - A dynamically-sized complex column vector, stored as a contiguous
Vec.
Enums§
- Complex
Dense Error - Errors returned by the complex dense linear-algebra routines.