From dd44414a8a27224c4a3d6e68d9368e3b3483d9ce Mon Sep 17 00:00:00 2001 From: Vollkornaffe Date: Fri, 8 Mar 2024 17:51:17 +0100 Subject: [PATCH] chore: Add test that fails before fix --- tests/linalg/eigen.rs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tests/linalg/eigen.rs b/tests/linalg/eigen.rs index a5dcf835..3fdd8e53 100644 --- a/tests/linalg/eigen.rs +++ b/tests/linalg/eigen.rs @@ -1,4 +1,4 @@ -use na::DMatrix; +use na::{DMatrix, Matrix3}; #[cfg(feature = "proptest-support")] mod proptest_tests { @@ -116,6 +116,31 @@ fn symmetric_eigen_singular_24x24() { ); } +// Test for #1368 +#[test] +fn very_small_deviation_from_identity() { + let m = Matrix3::::new( + 1.0, + 3.1575704e-23, + 8.1146196e-23, + 3.1575704e-23, + 1.0, + 1.7471054e-22, + 8.1146196e-23, + 1.7471054e-22, + 1.0, + ); + + for v in m + .try_symmetric_eigen(f32::EPSILON, 0) + .unwrap() + .eigenvalues + .into_iter() + { + assert_relative_eq!(*v, 1.); + } +} + // #[cfg(feature = "arbitrary")] // quickcheck! { // TODO: full eigendecomposition is not implemented yet because of its complexity when some