normalize

release/4.3a0
Varun Agrawal 2024-12-31 19:34:46 -05:00
parent 0e2e8bb8ce
commit 73f54083a7
1 changed files with 11 additions and 1 deletions

View File

@ -364,9 +364,19 @@ discreteElimination(const HybridGaussianFactorGraph &factors,
#if GTSAM_HYBRID_TIMING
gttic_(EliminateDiscreteFormDiscreteConditional);
#endif
DecisionTreeFactor joint;
// Normalize if we have only 1 key
// Needed due to conversion from TableFactor
if (product.discreteKeys().size() == 1) {
joint = DecisionTreeFactor(product.discreteKeys(),
product.toDecisionTreeFactor().normalize());
} else {
joint = product.toDecisionTreeFactor();
}
// Finally, get the conditional
auto conditional = std::make_shared<DiscreteConditional>(
product.toDecisionTreeFactor(), sum->toDecisionTreeFactor(), orderedKeys);
joint, sum->toDecisionTreeFactor(), orderedKeys);
#if GTSAM_HYBRID_TIMING
gttoc_(EliminateDiscreteFormDiscreteConditional);
#endif