2018-01-17 23:48:47 +08:00
|
|
|
#![cfg(feature = "arbitrary")]
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
use std::cmp;
|
|
|
|
|
|
|
|
use na::balancing;
|
2018-10-21 04:26:44 +08:00
|
|
|
use na::{DMatrix, Matrix4};
|
2017-08-03 01:37:44 +08:00
|
|
|
|
|
|
|
quickcheck! {
|
|
|
|
fn balancing_parlett_reinsch(n: usize) -> bool {
|
|
|
|
let n = cmp::min(n, 10);
|
|
|
|
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);
|
|
|
|
|
|
|
|
balanced == m
|
|
|
|
}
|
|
|
|
|
|
|
|
fn balancing_parlett_reinsch_static(m: Matrix4<f64>) -> bool {
|
|
|
|
let mut balanced = m;
|
|
|
|
let d = balancing::balance_parlett_reinsch(&mut balanced);
|
|
|
|
balancing::unbalance(&mut balanced, &d);
|
|
|
|
|
|
|
|
balanced == m
|
|
|
|
}
|
|
|
|
}
|