pub fn mean_par_iter<'a, It, T>(data: It) -> Twhere
    T: Clone + Div<f64, Output = T> + Sum<T> + Sum<It::Item> + Send + 'a + Sync,
    It: IndexedParallelIterator<Item = &'a T>,
Expand description

Compute the mean from a [rayon::iter::IndexedParallelIterator]. It uses the power of the parallel iterator to do the computation and might give better performance than mean.

Alternatively there is mean_par_iter_val for parallel iterator with non reference values.

Example

use lattice_qcd_rs::statistics::mean_par_iter;
use rayon::prelude::*;

let vec = vec![1_f64, 2_f64, 3_f64, 4_f64 /* ... */];
let mean = mean_par_iter(vec.par_iter());