bba1993e58
These warnings occurred only when running the test suite with no features. Lots of uses had to be rescoped into newly created modules to make it easier to separate these issues.
37 lines
1021 B
Rust
37 lines
1021 B
Rust
#![cfg(feature = "arbitrary")]
|
|
|
|
use std::cmp;
|
|
use na::{DMatrix, Matrix2, Matrix4};
|
|
|
|
#[test]
|
|
fn hessenberg_simple() {
|
|
let m = Matrix2::new(1.0, 0.0,
|
|
1.0, 3.0);
|
|
let hess = m.hessenberg();
|
|
let (p, h) = hess.unpack();
|
|
assert!(relative_eq!(m, p * h * p.transpose(), epsilon = 1.0e-7))
|
|
}
|
|
|
|
quickcheck! {
|
|
fn hessenberg(n: usize) -> bool {
|
|
let n = cmp::max(1, cmp::min(n, 50));
|
|
let m = DMatrix::<f64>::new_random(n, n);
|
|
|
|
let hess = m.clone().hessenberg();
|
|
let (p, h) = hess.unpack();
|
|
relative_eq!(m, &p * h * p.transpose(), epsilon = 1.0e-7)
|
|
}
|
|
|
|
fn hessenberg_static_mat2(m: Matrix2<f64>) -> bool {
|
|
let hess = m.hessenberg();
|
|
let (p, h) = hess.unpack();
|
|
relative_eq!(m, p * h * p.transpose(), epsilon = 1.0e-7)
|
|
}
|
|
|
|
fn hessenberg_static(m: Matrix4<f64>) -> bool {
|
|
let hess = m.hessenberg();
|
|
let (p, h) = hess.unpack();
|
|
relative_eq!(m, p * h * p.transpose(), epsilon = 1.0e-7)
|
|
}
|
|
}
|