Skip to main content

mahalanobis_sq

Function mahalanobis_sq 

Source
pub fn mahalanobis_sq(
    x: &[f64],
    mean_vec: &[f64],
    inv_cov: &[f64],
) -> Option<f64>
Expand description

Squared Mahalanobis distance (x − μ)ᵀ Σ⁻¹ (x − μ). The caller supplies the inverse covariance inv_cov (row-major d×d, obtained from the linear-algebra substrate) — this keeps the metric self-contained. None on a dimension mismatch.