2017-08-07 01:41:12 +08:00
|
|
|
use na::{DMatrix, Matrix4};
|
2018-11-07 01:32:20 +08:00
|
|
|
use nl::RealSchur;
|
|
|
|
use std::cmp;
|
2017-08-07 01:41:12 +08:00
|
|
|
|
|
|
|
quickcheck! {
|
|
|
|
fn schur(n: usize) -> bool {
|
|
|
|
let n = cmp::max(1, cmp::min(n, 10));
|
|
|
|
let m = DMatrix::<f64>::new_random(n, n);
|
|
|
|
|
|
|
|
let (vecs, vals) = RealSchur::new(m.clone()).unpack();
|
|
|
|
|
|
|
|
relative_eq!(&vecs * vals * vecs.transpose(), m, epsilon = 1.0e-7)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn schur_static(m: Matrix4<f64>) -> bool {
|
|
|
|
let (vecs, vals) = RealSchur::new(m.clone()).unpack();
|
|
|
|
|
|
|
|
relative_eq!(vecs * vals * vecs.transpose(), m, epsilon = 1.0e-7)
|
|
|
|
}
|
|
|
|
}
|