pub fn parallel_map_reduce<R, Map, Reduce>(
range: Range<usize>,
exec: Exec<'_>,
map: &Map,
reduce: &Reduce,
) -> RExpand description
Recursive halving map-reduce over range within the budget of exec.
map runs on the leaf ranges and reduce combines two neighbouring
results left to right, so the combination order depends only on the budget.
A serial token, a budget of one or a single-element range runs map on the
whole range on the calling thread.
ยงExamples
use strided_basic::execution::parallel_map_reduce;
use strided_basic::Exec;
let sum = parallel_map_reduce(0..100, Exec::serial(), &|r| r.sum::<usize>(), &|a, b| a + b);
assert_eq!(sum, 4950);