mtl5.qr#

mtl5.qr(A)#

Householder QR of a tall-or-square matrix (num_rows >= num_cols).

Accepts float32/float64 (and complex), plus every Universal dtype via mtl5.convert(). Returns a factorization exposing .solve(b) (least squares), .Q and .R.

From 16 bits up the Universal types factorize usefully; fixpnt16 is coarse (residual about 1.5e-2 on an 8x8 in-range matrix) but honest. The 8-bit formats are not usable: posit8, fp8 and fixpnt8 give residuals of 0.04 to 0.11. Read the result before trusting a narrow format.

Before MTL5 5.22.0, fp8, fixpnt8 and fixpnt16 failed silently: every reflector fell back to the identity, so .Q came back as the exact identity and .R as the upper triangle of A, which scores a perfect orthogonality check. MTL5 5.22.0’s reflector takes LAPACK dlarfg’s sign, which these formats can hold, so they now get real, if coarse, factors.