pub fn reduce<T: Copy, A: Clone>(
kept: (&[usize], &[isize]),
reduced: (&[usize], &[isize]),
data: &[T],
offset: isize,
out: &mut [A],
init: A,
f: impl Fn(A, T, usize) -> A,
block: impl Fn(A, &[T]) -> A,
)Expand description
Folds blocks of elements: out[i] is the fold of the reduced block at output position
i, starting from init. kept and reduced are (shape, strides) pairs that split the
input’s dimensions; the output is row-major over kept.
Contiguous blocks are passed whole to block; other blocks are folded element by element
with f, which also receives each element’s row-major index within its block. Both must
compute the same fold.
§Panics
As map1.