pub fn variance<YI, F>(y: YI) -> (F, usize)where
F: Float + Default + Sum,
YI: Iterator + Clone,
YI::Item: Borrow<F>,Expand description
Compute the variance of the signal, y
Return the variance and the number of points averaged
use approx::assert_relative_eq;
use sci_rs::stats::variance;
let y: [f64; 5] = [1.,2.,3.,4.,5.];
assert_relative_eq!(2f64, variance(y.iter()).0);
let y: &[f32] = &[];
assert_eq!((0f32, 0), variance(y.iter()));