pub fn segmented_reduce_sum(data: &[f64], segment_ids: &[usize]) -> Vec<f64>Expand description
Segmented reduction: sum values within each segment independently.
segment_ids[i] must be monotonically non-decreasing.
Returns a vector of partial sums, one per distinct segment id.
Example:
data = [1, 2, 3, 4, 5, 6]
segment_ids = [0, 0, 1, 1, 1, 2]
output = [3, 12, 6]