nalgebra/nalgebra-lapack/tests/linalg/symmetric_eigen.rs

21 lines
628 B
Rust
Raw Normal View History

use std::cmp;
use na::{DMatrix, Matrix4};
2018-10-22 13:00:10 +08:00
use nl::SymmetricEigen;
quickcheck!{
fn symmetric_eigen(n: usize) -> bool {
let n = cmp::max(1, cmp::min(n, 10));
let m = DMatrix::<f64>::new_random(n, n);
let eig = SymmetricEigen::new(m.clone());
let recomp = eig.recompose();
relative_eq!(m.lower_triangle(), recomp.lower_triangle(), epsilon = 1.0e-5)
}
fn symmetric_eigen_static(m: Matrix4<f64>) -> bool {
let eig = SymmetricEigen::new(m);
let recomp = eig.recompose();
relative_eq!(m.lower_triangle(), recomp.lower_triangle(), epsilon = 1.0e-5)
}
}