pub fn covariance_par_iter<'a, It1, It2, T>(
    data_1: It1,
    data_2: It2
) -> Option<T>where
    T: 'a + Clone + Div<f64, Output = T> + Sum<T> + Sum<It1::Item> + Send + Sync + Mul<T, Output = T> + Sub<T, Output = T> + Zero,
    It1: IndexedParallelIterator<Item = &'a T> + Clone,
    It2: IndexedParallelIterator<Item = &'a T> + Clone,
Expand description

Computes the covariance between two [rayon::iter::IndexedParallelIterator]. Returns None if the par iters are not of the same length.

The alternative for iterators returning references is covariance_par_iter_val.

Example

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

let vec = vec![1_f64, 2_f64, 3_f64, 4_f64];
let vec_2 = vec![1_f64, 2_f64, 3_f64];

let cov = covariance_par_iter(vec.par_iter(), vec_2.par_iter());
assert!(cov.is_none());

let vec = vec![1_f64, 2_f64, 3_f64, 4_f64];
let vec_2 = vec![1_f64, 2_f64, 3_f64, 4_f64];

let cov = covariance_par_iter(vec.par_iter(), vec_2.par_iter());
assert_eq!(cov, Some(1.25_f64));