From bd4ab1598e307d85c0953fc2e1a086040b08cf6d Mon Sep 17 00:00:00 2001 From: Mike Sheffler Date: Thu, 27 Sep 2018 18:19:44 -0700 Subject: [PATCH] Expanded shortcut_overlapping_separator test in testGaussianBayesTreeB to allow for sign reversal in a row of the augmented Jacobian. The joint density does not appear to be affected in the case where the augmented Jacobian row sign is changed, so we should not fail the test if that happens. --- tests/testGaussianBayesTreeB.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/testGaussianBayesTreeB.cpp b/tests/testGaussianBayesTreeB.cpp index 8b2aa3ae7..88b1aede2 100644 --- a/tests/testGaussianBayesTreeB.cpp +++ b/tests/testGaussianBayesTreeB.cpp @@ -317,8 +317,25 @@ TEST(GaussianBayesTree, shortcut_overlapping_separator) 5, 0, 6, 0, -11, -12 ).finished(); + Matrix actualJointJ = joint.augmentedJacobian(); + bool Row0RhsSignsEqual = + signbit(expectedJointJ(0, 2)) == signbit(actualJointJ(0, 2)); + + if (!Row0RhsSignsEqual) + { + expectedJointJ.row(0) = -expectedJointJ.row(0); + } + + bool Row1RhsSignsEqual = + signbit(expectedJointJ(1, 2)) == signbit(actualJointJ(1, 2)); + + if (!Row1RhsSignsEqual) + { + expectedJointJ.row(1) = -expectedJointJ.row(1); + } + EXPECT(assert_equal(expectedJointJ, actualJointJ)); }