Skip to main content

Module residual

Module residual 

Source
Expand description

DSFB-Debug: residual computation — paper §5.2 Equation (1).

Computes the residual vector r(k) = x(k) - x_hat(k) where x(k) is the observed measurement and x_hat(k) is the healthy-window baseline reference (computed in baseline.rs).

§Non-intrusion contract (type-enforced)

Every function in this module accepts &[f64] slices only — immutable references with no mut qualifier. The Rust type system enforces at compile time that we cannot modify the upstream observation x(k) or the baseline reference x_hat(k). This is the load-bearing observer-only guarantee of the engine (paper §1.x non-intrusion contract).

§Numerical handling

NaN inputs propagate to NaN residuals (no silent imputation at this layer); the sign.rs consumer detects NaN and stamps was_imputed = true on the resulting SignalEvaluation. This preserves the audit trail: the operator sees missing-data windows flagged, not silently zeroed.

Functions§

compute_residuals
Compute the residual vector r(k) = x(k) - x_hat(k)
residual_norm
Compute the norm (absolute value for scalar, Euclidean for vector) of a single residual value.