Skip to main content

Module linalg

Module linalg 

Source
Expand description

Minimal dense linear algebra (Cholesky) for the OLS long-AR path. Kept tiny on purpose; the core has no external dependencies.

Structs§

SquareMatrix
Dense column-major-agnostic square matrix stored row-major.

Functions§

ols
OLS fit of y on the columns of X (row-major rows × cols). Returns (beta, residual_variance, se) with se the classical standard errors sqrt(σ̂² (XᵀX)⁻¹_jj) and σ̂² = RSS / (rows - cols).
singular_values
Singular values of a dense rows × cols matrix (row-major), descending, by one-sided Jacobi: pairwise orthogonalisation of the columns until every pair is numerically orthogonal; the singular values are then the column norms. O(sweeps · cols² · rows) with a handful of sweeps — fine for the K × K matrices of the canonical-correlation step (K ≤ ~50).