nalgebra/tests/linalg/balancing.rs

29 lines
741 B
Rust
Raw Permalink Normal View History

2021-03-01 00:52:14 +08:00
#![cfg(feature = "proptest-support")]
use na::balancing;
2021-03-01 00:52:14 +08:00
use na::DMatrix;
use crate::proptest::*;
use proptest::{prop_assert_eq, proptest};
2021-03-01 00:52:14 +08:00
proptest! {
#[test]
fn balancing_parlett_reinsch(n in PROPTEST_MATRIX_DIM) {
let m = DMatrix::<f64>::new_random(n, n);
let mut balanced = m.clone();
let d = balancing::balance_parlett_reinsch(&mut balanced);
balancing::unbalance(&mut balanced, &d);
2021-03-01 00:52:14 +08:00
prop_assert_eq!(balanced, m);
}
2021-03-01 00:52:14 +08:00
#[test]
fn balancing_parlett_reinsch_static(m in matrix4()) {
let mut balanced = m;
let d = balancing::balance_parlett_reinsch(&mut balanced);
balancing::unbalance(&mut balanced, &d);
2021-03-01 00:52:14 +08:00
prop_assert_eq!(balanced, m);
}
}