From bd4ab1598e307d85c0953fc2e1a086040b08cf6d Mon Sep 17 00:00:00 2001 From: Mike Sheffler Date: Thu, 27 Sep 2018 18:19:44 -0700 Subject: [PATCH 1/2] 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)); } From 1ec15a734505495d3158a91b98699e4e16cc4351 Mon Sep 17 00:00:00 2001 From: Mike Sheffler Date: Fri, 28 Sep 2018 00:47:17 -0700 Subject: [PATCH 2/2] Incorporate Frank's suggestions for PR #315 --- tests/testGaussianBayesTreeB.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/tests/testGaussianBayesTreeB.cpp b/tests/testGaussianBayesTreeB.cpp index 88b1aede2..984728ebf 100644 --- a/tests/testGaussianBayesTreeB.cpp +++ b/tests/testGaussianBayesTreeB.cpp @@ -320,21 +320,12 @@ TEST(GaussianBayesTree, shortcut_overlapping_separator) Matrix actualJointJ = joint.augmentedJacobian(); - bool Row0RhsSignsEqual = - signbit(expectedJointJ(0, 2)) == signbit(actualJointJ(0, 2)); - - if (!Row0RhsSignsEqual) - { + // PR 315: sign of rows in joint are immaterial + if (signbit(expectedJointJ(0, 2)) != signbit(actualJointJ(0, 2))) expectedJointJ.row(0) = -expectedJointJ.row(0); - } - bool Row1RhsSignsEqual = - signbit(expectedJointJ(1, 2)) == signbit(actualJointJ(1, 2)); - - if (!Row1RhsSignsEqual) - { + if (signbit(expectedJointJ(1, 2)) != signbit(actualJointJ(1, 2))) expectedJointJ.row(1) = -expectedJointJ.row(1); - } EXPECT(assert_equal(expectedJointJ, actualJointJ)); }