Skip to main content

Module window

Module window 

Source
Expand description

Rolling window aggregations (sum, mean, min, max). Sliding-window functions for CJC.

Provides window_sum, window_mean, window_min, window_max over arrays of numeric values. These are commonly used in time-series analysis, data science pipelines, and signal processing.

§Determinism

  • window_sum and window_mean use Kahan summation for numerically stable, deterministic results.
  • All window functions produce the same output for the same input on every invocation.

§Semantics

All window functions take (data: &[f64], window_size: usize) and return a Vec<f64> of length data.len() - window_size + 1. That is, they produce one output per valid (full) window position.

If window_size is 0 or greater than data.len(), the result is empty.

Functions§

window_max
Sliding-window maximum.
window_mean
Sliding-window mean with Kahan summation.
window_min
Sliding-window minimum.
window_sum
Sliding-window sum with Kahan summation.