differential_dataflow::algorithms::prefix_sum

Trait PrefixSum

Source
pub trait PrefixSum<G: Scope, K, D> {
    // Required methods
    fn prefix_sum<F>(&self, zero: D, combine: F) -> Self
       where F: Fn(&K, &D, &D) -> D + 'static;
    fn prefix_sum_at<F>(
        &self,
        locations: Collection<G, (usize, K)>,
        zero: D,
        combine: F,
    ) -> Self
       where F: Fn(&K, &D, &D) -> D + 'static;
}
Expand description

Extension trait for the prefix_sum method.

Required Methods§

Source

fn prefix_sum<F>(&self, zero: D, combine: F) -> Self
where F: Fn(&K, &D, &D) -> D + 'static,

Computes the prefix sum for each element in the collection.

The prefix sum is data-parallel, in the sense that the sums are computed independently for each key of type K. For a single prefix sum this type can be (), but this permits the more general accumulation of multiple independent sequences.

Source

fn prefix_sum_at<F>( &self, locations: Collection<G, (usize, K)>, zero: D, combine: F, ) -> Self
where F: Fn(&K, &D, &D) -> D + 'static,

Determine the prefix sum at each element of location.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<G, K, D> PrefixSum<G, K, D> for Collection<G, ((usize, K), D)>