Function lattice_qcd_rs::statistics::variance
source · pub fn variance<'a, T, IntoIter>(data: IntoIter) -> Twhere
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 variance (squared of standard deviation) from a collections
Example
use lattice_qcd_rs::statistics::variance;
use nalgebra::Complex;
variance(&[1_f64, 2_f64, 3_f64, 4_f64]);
let vec = vec![1_f64, 2_f64, 3_f64, 4_f64];
variance(&vec);
let vec_complex = vec![Complex::new(1_f64, 2_f64), Complex::new(-7_f64, -9_f64)];
variance(&vec_complex);