linalg/decomp
src/linalg/decomp.tur
matrix decompositions (Cholesky, LU, QR)
defstruct
cholfac
(defstruct cholfac [L : mat])
Factor structs (move-only: they own their mats / pivot).
defstruct
lufac
(defstruct lufac [L : mat U : mat piv : (Vec int)])
defstruct
qrfac
(defstruct qrfac [Q : mat R : mat])
defn
chol
(chol [^borrow a : mat] :)
Cholesky decomposition A = L L'. Panics if A is not square or not
defn
chol-free
(chol-free [f : cholfac] :)
free a Cholesky factor.
defn
lu
(lu [^borrow a : mat] :)
LU decomposition P A = L U with partial pivoting. Panics if A is not
defn
lu-free
(lu-free [f : lufac] :)
free an LU factor.
defn
qr
(qr [^borrow a : mat] :)
QR decomposition A = Q R via Householder. Panics if rows < cols.
defn
qr-free
(qr-free [f : qrfac] :)
free a QR factor.
Internal definitions
__izeros-- Private: a (Vec int) of n zeros (LU pivot scratch).__chol-kernel-- Cholesky (Cholesky-Banachiewicz): A = L L', A symmetric pos-def.__lu-kernel-- LU with partial pivoting (Doolittle): P A = L U.__qr-kernel-- QR via Householder reflections: A = Q R (Q m x m, R m x n).