Skip to main content

solve_spd

Function solve_spd 

Source
fn solve_spd(s: &[f64], b: &[f64], n: usize, m: usize) -> Vec<f64>
Expand description

Solve the symmetric positive-definite system S X = B via Cholesky factorisation. S (n×n, row-major) is a ridge-regularised normal-equations matrix XᵀX + εI, which is positive-definite for any ε > 0; B is n×m, row-major. Returns X (n×m, row-major).

Cholesky is the numerically-optimal factorisation for an SPD system — half the arithmetic of LU and unconditionally stable without pivoting — and a single factorisation solves every right-hand-side column at once. Falls back to a zero solution if S is not positive-definite; this cannot occur while the ε ridge is present but keeps the solve total for degenerate inputs.