Factorization examples — shared helpers #
Small Float-valued helpers used by the matrix-factorization examples (Cholesky, QR). Each
example reconstructs the original matrix from its factors and asserts (via #eval) that the maximum
entrywise reconstruction error is below a tolerance, so the build fails if a factorization is wrong.
These run over Float (the executable 64-bit runtime scalar), which is the precision the
factorizations target for Gaussian-process / kernel-method use.
Maximum entrywise absolute difference between two m × n matrices.
Instances For
Matrix product $AB$ (thin wrapper over matMulSpec).
Instances For
Matrix transpose.
Instances For
Read a vector tensor back out as a List Float (for display).
Instances For
Squared Frobenius distance
$\sum_{i,j}(A_{ij}-B_{ij})^2$ between two m × n matrices.
Instances For
Shared tolerance for reconstruction-error assertions.
Instances For
Compiled positive assertion: print name: OK (err) when $\mathrm{err}<\mathrm{tol}$, otherwise raise an
IO error so the build/#eval fails. Running this through #eval evaluates with the compiler
(fast), unlike #guard, which forces slow kernel reduction of the whole factorization.
Instances For
Compiled negative-control assertion: succeeds only when
$\mathrm{err}\ge\mathrm{threshold}$, i.e. when a property
that should not hold is correctly detected as violated. Gives the metric teeth — a reviewer can see
the same maxMatErr/residual that reports 0 on a valid factorization reports a large value on an
invalid one, so the positive checks are not vacuous.
Instances For
Compiled negative-control assertion that a reconstruction fails: succeeds when the error is not
below tol — including the NaN produced when a hypothesis is violated (e.g. Cholesky of a
non-positive-definite matrix takes √(negative)). Documents that the success hypotheses (positive
Cholesky pivots, positive R pivots / full column rank) are genuinely necessary.