Expand description
Canonical orthogonal rotation matrix (ChaCha → faer QR → sign correction).
Pipeline:
- Fill a
dim * dimrow-majorf64buffer from [ChaChaGaussianStream]. - Load the buffer into a faer
Mat<f64>and computeA = Q Rviafaer::Mat::qr. - Apply the Haar-measure sign correction
Q[:, j] *= sign(R[j, j])so that the resulting orthogonal matrix is uniquely determined by the RNG stream (mirrors the Python reference). - Store the corrected
Qin row-major order inside anArc<[f64]>.
Numerical contract:
apply_intopromotesf32tof64, does the matmul inf64, and casts the result back tof32. This matchesNumPy’s implicit promotion forfloat64 @ float32and is required for the round-trip parity target of< 1e-5.apply_inverse_intouses the stored matrix’s transpose (valid because it’s orthogonal), again with anf64accumulator.
See docs/design/rust/numerical-semantics.md §R1 for the full recipe
and rationale.
Structs§
- Rotation
Matrix - Deterministically generated orthogonal matrix for vector preconditioning.