parallel_map_reduce_indexed

Function parallel_map_reduce_indexed 

Source
pub fn parallel_map_reduce_indexed<R, T, M, Red>(
    range: R,
    chunk_size: usize,
    mapper: M,
    reducer: Red,
) -> T
where R: Iterator<Item = usize> + Send, T: Send + Clone, M: Fn(&[usize]) -> T + Sync + Send, Red: Fn(T, T) -> T + Sync + Send,
Expand description

Parallel map-reduce operation on indexed chunks

This function takes a range of indices, splits them into chunks of the specified size, processes each chunk in parallel using the mapper function, and then reduces the results using the reducer function.

§Arguments

  • range - The range of indices to process (e.g., 0..n)
  • chunk_size - Size of each chunk for parallel processing
  • mapper - Function that processes a slice of indices and returns a result
  • reducer - Function that combines two results into one

§Returns

The final reduced result