To factor a matrix into an orthogonal Q and an upper-triangular R — the stable heart of least-squares and eigenvalue solvers — Householder reflects each column so everything below the diagonal becomes zero in one stroke. A mirror, not the slow one-vector-at-a-time orthogonalisation, and far more numerically stable.
For a column x, choose the reflection that maps it exactly onto the first axis — length −‖x‖ in the diagonal slot, zeros below. The mirror is H = I − 2 vvᵀ/vᵀv, applied as a cheap rank-1 update so the full matrix is never built. Repeat per column to reach R. Watch a vector snap to the axis. live demo
“QR = Gram-Schmidt” — classical Gram-Schmidt is the method the unstable one; Householder’s reflections are what solvers actually run. cited
Givens rotations zero one entry at a time; Householder zeros a column at a time — the workhorse of dense QR. Householder 1958
A reflection is dot products, a norm (stdlib sqrt / isqrt), and a rank-1 update — all f64, and it runs on the compiler: