Skip to main content

rolling_sum_i64

Function rolling_sum_i64 

Source
pub fn rolling_sum_i64(data: &[i64], window: usize) -> Vec<Option<i64>>
Expand description

Rolling sum over i64 data with O(n) sliding window.

Positions before the window is full are set to None (caller maps to NaN or whatever sentinel is appropriate). Uses wrapping arithmetic.

Returns a Vec of length data.len(). Elements 0..window-1 are None.