pub fn mean_and_variance<'a, T, IntoIter>(data: IntoIter) -> [T; 2]where
    T: 'a + Div<f64, Output = T> + Sum<&'a T> + Sum<T> + Mul<T, Output = T> + Clone + Sub<T, Output = T>,
    IntoIter: IntoIterator<Item = &'a T> + Clone,
    IntoIter::IntoIter: ExactSizeIterator,
Expand description

Compute the mean and variance (squared of standard deviation) from a collection.

Example

use lattice_qcd_rs::statistics::mean_and_variance;
use nalgebra::Complex;

mean_and_variance(&[1_f64, 2_f64, 3_f64, 4_f64]);
let vec = vec![1_f64, 2_f64, 3_f64, 4_f64];
mean_and_variance(&vec);
let vec_complex = vec![Complex::new(1_f64, 2_f64), Complex::new(-7_f64, -9_f64)];
mean_and_variance(&vec_complex);