use std::fmt::Display;
pub fn stddev<T: Display + std::fmt::Debug>(array: Vec<T>) -> f64 {
let len = array.len();
if len <= 1 {
return 0.0;
}
let mut total = 0.0;
let mut values = vec![];
for item in array {
let value = item.to_string().parse::<f64>().unwrap();
values.push(value);
total += value;
}
let mean = total / len.to_string().parse::<f64>().unwrap();
total = 0.0;
let _: Vec<f64> = values.iter_mut().map(|val| {
let t = (*val - mean).powi(2);
total += t;
t
}).collect();
(total / (len - 1) as f64).sqrt()
}
pub struct Spc {}
impl Spc {
}