rolling_sum_int

Function rolling_sum_int 

Source
pub fn rolling_sum_int<T: Num + Copy + Zero>(
    window: IntegerAVT<'_, T>,
    subwindow: usize,
) -> IntegerArray<T>
Expand description

Computes rolling sums over a sliding window for integer data with null-aware semantics.

Applies a sliding window of configurable size to compute cumulative sums, employing incremental computation to avoid O(n²) complexity through efficient push-pop operations. Each position in the output represents the sum of values within the preceding window.

§Parameters

  • window - Integer array view containing the data, offset, and length information
  • subwindow - Size of the sliding window (number of elements to sum)

§Returns

Returns an IntegerArray<T> containing:

  • Rolling sums for each position where a complete window exists
  • Zero values for positions before the window is complete
  • Null mask indicating validity (false for incomplete windows or null-contaminated windows)

§Examples

use minarrow::IntegerArray;
use simd_kernels::kernels::window::rolling_sum_int;

let arr = IntegerArray::<i32>::from_slice(&[1, 2, 3, 4, 5]);
let result = rolling_sum_int((&arr, 0, arr.len()), 3);