fix creation of DiscreteConditional
parent
094b76df2d
commit
bf4c0bd72d
|
|
@ -351,8 +351,7 @@ discreteElimination(const HybridGaussianFactorGraph &factors,
|
||||||
// All the discrete variables should form a single clique,
|
// All the discrete variables should form a single clique,
|
||||||
// so we can sum out on all the variables as frontals.
|
// so we can sum out on all the variables as frontals.
|
||||||
// This should give an empty separator.
|
// This should give an empty separator.
|
||||||
Ordering orderedKeys(product.keys());
|
TableFactor::shared_ptr sum = product.sum(frontalKeys);
|
||||||
TableFactor::shared_ptr sum = product.sum(orderedKeys);
|
|
||||||
#if GTSAM_HYBRID_TIMING
|
#if GTSAM_HYBRID_TIMING
|
||||||
gttoc_(EliminateDiscreteSum);
|
gttoc_(EliminateDiscreteSum);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -361,8 +360,9 @@ discreteElimination(const HybridGaussianFactorGraph &factors,
|
||||||
gttic_(EliminateDiscreteFormDiscreteConditional);
|
gttic_(EliminateDiscreteFormDiscreteConditional);
|
||||||
#endif
|
#endif
|
||||||
// Finally, get the conditional
|
// Finally, get the conditional
|
||||||
auto conditional =
|
auto c = product / (*sum);
|
||||||
std::make_shared<DiscreteConditional>(product, *sum, orderedKeys);
|
auto conditional = std::make_shared<DiscreteConditional>(
|
||||||
|
frontalKeys.size(), c.toDecisionTreeFactor());
|
||||||
#if GTSAM_HYBRID_TIMING
|
#if GTSAM_HYBRID_TIMING
|
||||||
gttoc_(EliminateDiscreteFormDiscreteConditional);
|
gttoc_(EliminateDiscreteFormDiscreteConditional);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -162,6 +162,7 @@ TEST(GaussianMixture, GaussianMixtureModel2) {
|
||||||
EXPECT_DOUBLES_EQUAL(expected, posterior2(m1Assignment), 1e-8);
|
EXPECT_DOUBLES_EQUAL(expected, posterior2(m1Assignment), 1e-8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
int main() {
|
int main() {
|
||||||
TestResult tr;
|
TestResult tr;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue