Skip to main content

Module sign

Module sign 

Source
Expand description

DSFB-Debug: sign-tuple computation — paper §5.3 Equation (2).

Computes the per-(window, signal) residual signature σ(k) = (‖r(k)‖, ṙ(k), r̈(k)) where:

  • ‖r(k)‖ — instantaneous deviation magnitude (provided by residual::residual_norm)
  • ṙ(k) — finite-difference drift rate over a fixed-width window W (window-to-window slope)
  • r̈(k) — first difference of the drift (curvature of the trajectory; “slew”)

σ(k) is the structural signature consumed by the grammar evaluator; it captures both where the residual is (norm) and where it is going (drift, slew). This second-order information is the structural-detectability advantage over flat thresholding, which sees only the norm.

The computation is a deterministic two-pass over the residual window: pass 1 computes the regression slope (drift), pass 2 takes the first difference of consecutive drift values (slew). No allocation; works in-place on the residual slice.

Functions§

boundary_density
Compute rolling boundary density: fraction of last W windows in Boundary state. states is a slice of 0=Admissible, 1=Boundary, 2=Violation
compute_sign_tuple
Compute the sign tuple for a single signal at window k.
drift_persistence
Compute rolling drift persistence: fraction of last W windows with drift > 0
slew_density
Compute rolling slew density: fraction of last W windows with |slew| > δ_s