Expand description
Householder QR factorisation + least-squares solve (caller-owned, zero-heap).
Householder QR decomposition A = Q·R and least-squares solve.
Functionality parity with nalgebra’s linalg::qr, in the qualia idiom:
zero allocation, operating on caller-owned row-major slices, fail-closed.
No DMatrix, no heap, no dependency.
QR is the stable workhorse the engine was missing entirely (the prior LA had
only fixed-size Matrix4x4 LU and the silo’s heap routines). It gives:
- orthogonal factorisation
A(m×n) = Q(m×m)·R(m×n),m ≥ n; - least-squares
min‖A·x − b‖for overdetermined full-rank systems (the normal-equations route proved in [super::gemm], but numerically stable — noAᵀAconditioning blow-up); - a square linear solve as the
m == ncase (alternative to LU).
Storage convention (LAPACK geqrf style): [qr_factor] overwrites a in
place — the upper triangle (incl. diagonal) becomes R; below the diagonal
holds the essential Householder vectors v (with implicit v[j] = 1); the
per-column scalings go in tau.
Functions§
- qr_
factor - Compute the Householder QR factorisation of the
m×nrow-major matrixa(m ≥ n) in place. On return: - qr_
form_ q - Materialise the thin orthogonal factor
Q(m×n, row-major) from a factoreda/tau(fromqr_factor).qmust be lengthm*n. The thinQsatisfiesQ·R_n = A(withR_nthen×nupper triangle ofa) and has orthonormal columns (Qᵀ·Q = I_n). - qr_
solve_ least_ squares - Least-squares solve
min‖A·x − b‖for anm×n(m ≥ n) full-rank system, given the factoreda/tau(fromqr_factor).