2023-04-24 05:46:06 +08:00
|
|
|
#[cfg(test)]
|
|
|
|
use crate::DVector;
|
|
|
|
#[test]
|
|
|
|
fn test_variance_new() {
|
2023-04-25 04:22:32 +08:00
|
|
|
let long_repeating_vector = DVector::repeat(10_000, 100000000.0);
|
|
|
|
assert_eq!(long_repeating_vector.variance(), 0.0);
|
|
|
|
|
|
|
|
let short_vec = DVector::from_vec(vec![1., 2., 3.]);
|
|
|
|
assert_eq!(short_vec.variance(), 2.0 / 3.0)
|
2023-04-24 05:46:06 +08:00
|
|
|
}
|