diff --git a/nalgebra-sparse/Cargo.toml b/nalgebra-sparse/Cargo.toml index 8284bc7a..3f9f8c8a 100644 --- a/nalgebra-sparse/Cargo.toml +++ b/nalgebra-sparse/Cargo.toml @@ -19,5 +19,5 @@ matrixcompare-core = { version = "0.1.0", optional = true } [dev-dependencies] itertools = "0.9" -matrixcompare = "0.1.3" +matrixcompare = { version = "0.2.0", features = [ "proptest-support" ] } nalgebra = { version="0.23", path = "../", features = ["compare"] } diff --git a/nalgebra-sparse/tests/unit_tests/cholesky.rs b/nalgebra-sparse/tests/unit_tests/cholesky.rs index 95550278..87517828 100644 --- a/nalgebra-sparse/tests/unit_tests/cholesky.rs +++ b/nalgebra-sparse/tests/unit_tests/cholesky.rs @@ -6,7 +6,7 @@ use nalgebra_sparse::proptest::csc; use nalgebra::{Matrix5, Vector5, Cholesky, DMatrix}; use proptest::prelude::*; -use matrixcompare::assert_matrix_eq; +use matrixcompare::{assert_matrix_eq, prop_assert_matrix_eq}; fn positive_definite() -> impl Strategy> { let csc_f64 = csc(value_strategy::(), @@ -29,11 +29,10 @@ proptest! { let l = cholesky.take_l(); let matrix_reconstructed = &l * l.transpose(); - // TODO: Use matrixcompare instead - let diff = DMatrix::from(&(matrix_reconstructed - matrix)); - prop_assert!(diff.abs().max() < 1e-8); + prop_assert_matrix_eq!(matrix_reconstructed, matrix, comp = abs, tol = 1e-8); - // TODO: Check that L is in fact lower triangular + let is_lower_triangular = l.triplet_iter().all(|(i, j, _)| j <= i); + prop_assert!(is_lower_triangular); } }