fix naming

release/4.3a0
Varun Agrawal 2025-01-01 19:23:12 -05:00
parent 795780d647
commit ebd523eea4
1 changed files with 6 additions and 7 deletions

View File

@ -112,13 +112,12 @@ namespace gtsam {
// }
/**
* @brief Multiply all the `factors` and normalize the
* product to prevent underflow.
* @brief Multiply all the `factors`.
*
* @param factors The factors to multiply as a DiscreteFactorGraph.
* @return DecisionTreeFactor
*/
static DecisionTreeFactor ProductAndNormalize(
static DecisionTreeFactor DiscreteProduct(
const DiscreteFactorGraph& factors) {
// PRODUCT: multiply all factors
gttic(product);
@ -126,10 +125,10 @@ namespace gtsam {
gttoc(product);
// Max over all the potentials by pretending all keys are frontal:
auto normalizer = product.max(product.size());
auto denominator = product.max(product.size());
// Normalize the product factor to prevent underflow.
product = product / (*normalizer);
product = product / (*denominator);
return product;
}
@ -139,7 +138,7 @@ namespace gtsam {
std::pair<DiscreteConditional::shared_ptr, DiscreteFactor::shared_ptr> //
EliminateForMPE(const DiscreteFactorGraph& factors,
const Ordering& frontalKeys) {
DecisionTreeFactor product = ProductAndNormalize(factors);
DecisionTreeFactor product = DiscreteProduct(factors);
// max out frontals, this is the factor on the separator
gttic(max);
@ -217,7 +216,7 @@ namespace gtsam {
std::pair<DiscreteConditional::shared_ptr, DiscreteFactor::shared_ptr> //
EliminateDiscrete(const DiscreteFactorGraph& factors,
const Ordering& frontalKeys) {
DecisionTreeFactor product = ProductAndNormalize(factors);
DecisionTreeFactor product = DiscreteProduct(factors);
// sum out frontals, this is the factor on the separator
gttic(sum);