Expand description
Dense linear solves and general complex eigensystems with analytic derivatives, and restarted GMRES. treams-rs extension.
Two libraries share the linear algebra, by one rule:
- nalgebraβs
DMatrixstores every dense matrix. - faer factors and multiplies dense complex matrices of any size, through this
module: LU solves (
solve,Lu), singular values (svdvals), eigensystems (eig) and products (productand its variants).viewandview_mutlend aDMatrixto faer without a copy. - Real symmetric eigenproblems use nalgebraβs
SymmetricEigen:special::wignerdiagonalizes the tridiagonal generator of the small-d matrix, of size 2l + 1. - Fixed-size matrices of at most 4 x 4 stay in nalgebra: the 3 x 3 inverse of
lattice::reciprocal, the closed-form 2 x 2 inverse ofcoeffs::mie, the 4 x 4 and 2 x 2 inverses ofcoeffs::mie_cyland the 4 x 4 inverse ofsmatrix::interface.
ModulesΒ§
- gmres π
- Restarted GMRES (generalized minimal residual method) for complex linear systems given only through matrix-vector products. treams-rs extension.
- saved π
- Fixed numerical layouts for invocation-owned JAX state. Dimensions are stored as u64; all other data are IEEE f64 components in column-major order. treams-rs extension.
StructsΒ§
- Convergence
- Proof of convergence for one right-hand side: the residual
b - A xrecomputed from the returned answerx, not the estimate of the Arnoldi iteration. - EigResidual
- What
eigsaves for its derivatives: the right eigensystem, with unit vectors whose largest component is real and positive. - Equilibration π
- Positive diagonal scales for the equivalent operator
R A C. - Gmres
Options - Accuracy and memory budget of restarted GMRES.
- Lu π
- Packed pivoted LU: overwrite the operator and share its triangular storage.
- Solve
Gradient - Cotangents of the inputs of
solveandsolve_owned, in the order of their arguments. - Solve
Residual - What
solvesaves for its derivatives: the LU factors and the solution. Both derivative directions solve with the same factors. - Svdvals
Residual - What
svdvalssaves for its derivatives: the thin singular vectors and the singular values. - ThinSvd π
- Thin singular vectors and values. faerβs
Svdreads faerβs global parallelism, so the decomposition is called withDECOMPOSITIONinstead.
ConstantsΒ§
- BALANCE_
SWEEPS π - The most sweeps of
balance; dense operators take at most three. - DECOMPOSITION π
- Eigen- and singular-value decompositions run on the calling thread. faerβs parallel Hessenberg and bidiagonal reductions split inner products by worker count, so their last bits, and the order of eigenvalues, would follow the budget. On four workers they gained at most 1.3Γ (eigenvalues) and 1.7Γ (singular values) at n = 768, and nothing below n = 384.
FunctionsΒ§
- balance π
- Even out the row and column sums of a max-equilibrated operator in place with
power-of-two factors, folded into
rowandcolumn. - eig
- General complex eigendecomposition. Repeated eigenvalues are allowed in the primal.
- eigen π
- Eigenvalues and right eigenvectors, called with an explicit
Parasthin_svd. - eigvals
- Eigenvalues ordered by real part, then imaginary part. The same eigensystem residual supplies derivatives without imposing an eigenvector phase constraint.
- equilibrate π
- Equilibrate severely unbalanced finite square operators in place.
- faer_
zeros π - Reserve decomposition vectors before initializing their entries.
- lu_
threads π - The faer workers of an LU factorization or solve with
rowsrows andcolumnsright-hand sides, on a pool ofbudgetthreads. - lu_
workers π - The faer workers of an LU call on the treams-rs budget.
- product π
left right.- product_
adjoint_ πright left rightα΄΄.- product_
adjoint_ πright_ into out = left rightα΄΄, reusing the allocation ofout.- product_
into π out = left righton the treams-rs pool (crate::threads::product). Pass.adjoint()views for conjugate-transposed factors; faer conjugates them inside the product kernel.- product_
views π left rightin a new matrix; seeproduct_into.- scale_
rows π matrix[(i, j)] scales[i] 2^shifts[j], rounded once unless subnormal. A shifted column splits each scale into a mantissa and a power of two, and applies the power first when it scales up, so no intermediate product overflows or flushes a subnormal entry.- scratch π
- A faer workspace of
req, orError::OutOfMemorywhen the system refuses it or the requirement overflowed. - solve
- Solve A X = B with pivoted LU; B is a matrix of right-hand sides.
- solve_
owned - Solve while reusing the owned operator buffer for its LU factors.
- svdvals
- Singular values of a finite nonempty rectangular complex matrix.
- thin_
svd π - view π
- Column-major faer view of a nalgebra matrix.
- view_
mut π - Mutable column-major faer view of a nalgebra matrix.