From 748db19795d6c51d9d18b74355540544081e8ceb Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Wed, 25 Dec 2024 13:13:21 -0500 Subject: [PATCH] rename normalization to normalizer --- gtsam/discrete/DiscreteFactorGraph.cpp | 7 +++---- gtsam/discrete/tests/testDiscreteFactorGraph.cpp | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/gtsam/discrete/DiscreteFactorGraph.cpp b/gtsam/discrete/DiscreteFactorGraph.cpp index d0bf21047..169259a36 100644 --- a/gtsam/discrete/DiscreteFactorGraph.cpp +++ b/gtsam/discrete/DiscreteFactorGraph.cpp @@ -126,10 +126,10 @@ namespace gtsam { gttoc(product); // Max over all the potentials by pretending all keys are frontal: - auto normalization = product.max(product.size()); + auto normalizer = product.max(product.size()); // Normalize the product factor to prevent underflow. - product = product / (*normalization); + product = product / (*normalizer); return product; } @@ -207,8 +207,7 @@ namespace gtsam { return dag.argmax(); } - DiscreteValues DiscreteFactorGraph::optimize( - const Ordering& ordering) const { + DiscreteValues DiscreteFactorGraph::optimize(const Ordering& ordering) const { gttic(DiscreteFactorGraph_optimize); DiscreteLookupDAG dag = maxProduct(ordering); return dag.argmax(); diff --git a/gtsam/discrete/tests/testDiscreteFactorGraph.cpp b/gtsam/discrete/tests/testDiscreteFactorGraph.cpp index 0d71c12ba..cbcf5234e 100644 --- a/gtsam/discrete/tests/testDiscreteFactorGraph.cpp +++ b/gtsam/discrete/tests/testDiscreteFactorGraph.cpp @@ -117,9 +117,9 @@ TEST(DiscreteFactorGraph, test) { *std::dynamic_pointer_cast(newFactorPtr); // Normalize newFactor by max for comparison with expected - auto normalization = newFactor.max(newFactor.size()); + auto normalizer = newFactor.max(newFactor.size()); - newFactor = newFactor / *normalization; + newFactor = newFactor / *normalizer; // Check Conditional CHECK(conditional); @@ -131,9 +131,9 @@ TEST(DiscreteFactorGraph, test) { CHECK(&newFactor); DecisionTreeFactor expectedFactor(B & A, "10 6 6 10"); // Normalize by max. - normalization = expectedFactor.max(expectedFactor.size()); - // Ensure normalization is correct. - expectedFactor = expectedFactor / *normalization; + normalizer = expectedFactor.max(expectedFactor.size()); + // Ensure normalizer is correct. + expectedFactor = expectedFactor / *normalizer; EXPECT(assert_equal(expectedFactor, newFactor)); // Test using elimination tree