From 70fa5681319330f33a7b0779c7a7d976a33e6d61 Mon Sep 17 00:00:00 2001 From: Kevin Date: Sat, 11 Feb 2023 19:59:16 -0500 Subject: [PATCH] Normalize products by max in discrete elimination. --- gtsam/discrete/DiscreteFactorGraph.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gtsam/discrete/DiscreteFactorGraph.cpp b/gtsam/discrete/DiscreteFactorGraph.cpp index 7d07043b2..4ededbb8b 100644 --- a/gtsam/discrete/DiscreteFactorGraph.cpp +++ b/gtsam/discrete/DiscreteFactorGraph.cpp @@ -121,8 +121,8 @@ namespace gtsam { for (auto&& factor : factors) product = (*factor) * product; gttoc(product); - // Sum all the potentials by pretending all keys are frontal: - auto normalization = product.sum(product.size()); + // Max over all the potentials by pretending all keys are frontal: + auto normalization = product.max(product.size()); // Normalize the product factor to prevent underflow. product = product / (*normalization); @@ -210,8 +210,8 @@ namespace gtsam { for (auto&& factor : factors) product = (*factor) * product; gttoc(product); - // Sum all the potentials by pretending all keys are frontal: - auto normalization = product.sum(product.size()); + // Max over all the potentials by pretending all keys are frontal: + auto normalization = product.max(product.size()); // Normalize the product factor to prevent underflow. product = product / (*normalization);