fn solve_spd(a: &[f64], b: &[f64], n: usize, m: usize) -> Vec<f64>Expand description
Solve the symmetric positive-definite system A X = B via Cholesky
factorisation. a is n×n row-major — here the ridge-regularised within-class
scatter, which is SPD — and b is n×m row-major; returns X (n×m, row-major).
A single factorisation solves every right-hand-side column (one per class),
the numerically optimal route for an SPD system: half the arithmetic of a
general elimination and unconditionally stable without pivoting. Falls back to
a zero solution if a is not positive-definite, which the ridge precludes.