Skip to main content

parallel_scan

Function parallel_scan 

Source
pub fn parallel_scan<T, F>(
    data: &[T],
    identity: T,
    op: F,
    mode: ScanMode,
    n_threads: usize,
) -> CoreResult<Vec<T>>
where T: Clone + Send + 'static, F: Fn(T, T) -> T + Send + Sync + 'static,
Expand description

Parallel prefix scan (generalised prefix sum) using Blelloch’s algorithm.

The op must be associative (but need not be commutative).

§Arguments

  • data – input slice
  • identity – identity element for op (needed for Exclusive scans)
  • op – associative binary operator
  • modeScanMode::Inclusive or ScanMode::Exclusive
  • n_threads – degree of parallelism (0 = auto)