simplify discrete conditional computation
parent
a71008d7fd
commit
57c426a870
|
|
@ -364,19 +364,9 @@ discreteElimination(const HybridGaussianFactorGraph &factors,
|
||||||
#if GTSAM_HYBRID_TIMING
|
#if GTSAM_HYBRID_TIMING
|
||||||
gttic_(EliminateDiscreteFormDiscreteConditional);
|
gttic_(EliminateDiscreteFormDiscreteConditional);
|
||||||
#endif
|
#endif
|
||||||
DecisionTreeFactor joint;
|
auto c = product / (*sum);
|
||||||
// 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>(
|
auto conditional = std::make_shared<DiscreteConditional>(
|
||||||
joint, sum->toDecisionTreeFactor(), orderedKeys);
|
c.toDecisionTreeFactor(), frontalKeys.size(), orderedKeys);
|
||||||
#if GTSAM_HYBRID_TIMING
|
#if GTSAM_HYBRID_TIMING
|
||||||
gttoc_(EliminateDiscreteFormDiscreteConditional);
|
gttoc_(EliminateDiscreteFormDiscreteConditional);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue