Provide test case for a diagonal matrix resulting in NaN values from the QR eigenvalue computation.
This commit is contained in:
parent
0f24c2d8fc
commit
98e0526bbb
16
tests/mat.rs
16
tests/mat.rs
|
@ -583,6 +583,22 @@ fn test_eigen_qr_mat6() {
|
||||||
test_eigen_qr_impl!(Mat6<f64>);
|
test_eigen_qr_impl!(Mat6<f64>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use std::f64;
|
||||||
|
use na::Iterable;
|
||||||
|
#[test]
|
||||||
|
fn test_eigen_qr_diagonal() {
|
||||||
|
let cov = Mat3::new( 1.0, 0.0, 0.0,
|
||||||
|
0.0, 1.0, 0.0,
|
||||||
|
0.0, 0.0, 1.0 );
|
||||||
|
let (eigvec, eigval) = na::eigen_qr(&cov, &f64::EPSILON, 1000);
|
||||||
|
for x in eigvec.iter() {
|
||||||
|
assert!( !x.is_nan(), "NaN values detected, eigvec = {:?}", eigvec );
|
||||||
|
}
|
||||||
|
for x in eigval.iter() {
|
||||||
|
assert!( !x.is_nan(), "NaN values detected, eigval = {:?}", eigval );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_from_fn() {
|
fn test_from_fn() {
|
||||||
let actual: DMat<usize> = DMat::from_fn(3, 4, |i, j| 10 * i + j);
|
let actual: DMat<usize> = DMat::from_fn(3, 4, |i, j| 10 * i + j);
|
||||||
|
|
Loading…
Reference in New Issue