Normalize products by max in discrete elimination.

release/4.3a0
Kevin 2023-02-11 19:59:16 -05:00
parent feaa07ad02
commit 70fa568131
1 changed files with 4 additions and 4 deletions

View File

@ -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);