Skip to main content

Module decomp

Module decomp 

Source
Expand description

Matrix decompositions, one per file — general-purpose kernels for future use across the library (regression, calibration, PCA, factor models), independent of any finance semantics.

  • cholesky: A = L L^T for symmetric PSD matrices, plus the SPD linear solve through the factor — the fast path for normal equations and covariance sampling;
  • [qr]: Householder QR (A = Q R, thin form), plus numerically stable linear least squares — the right tool for regression (e.g. Longstaff-Schwartz bases) without forming A^T A;
  • [svd]: one-sided Jacobi singular value decomposition (A = U S V^T), plus the minimum-norm pseudo-inverse solve for rank-deficient problems;
  • eigen: cyclic Jacobi eigendecomposition of symmetric matrices — the engine behind the PSD projection in nearest_correlation.

All matrices are Vec<Vec<f64>> row-major, matching the rest of the crate; the implementations favor clarity and robustness on the small-to-moderate sizes quant workflows use.

Re-exports§

pub use cholesky::cholesky_factor;
pub use cholesky::cholesky_solve;
pub use eigen::symmetric_eigen;
pub use qr::least_squares;
pub use qr::qr;
pub use svd::pseudo_solve;
pub use svd::svd;

Modules§

cholesky
Cholesky factorization A = L L^T of a symmetric positive (semi-)definite matrix, and the SPD linear solve through the factor.
eigen
Eigendecomposition of symmetric matrices by the cyclic Jacobi method — robust and accurate for the small matrices of correlation and covariance work (the PSD projection inside Higham’s nearest-correlation algorithm runs on this).
qr
Householder QR decomposition and numerically stable linear least squares (no A^T A squaring of the condition number).
svd
Singular value decomposition by one-sided Jacobi rotations — simple, accurate for the small-to-moderate matrices of quant workflows, and rank-revealing. A = U diag(S) V^T with orthonormal U (m x n, columns for nonzero singular values), non-negative S sorted descending, and orthogonal V (n x n).