use DiscreteFactor everywhere in DiscreteFactorGraph.cpp

release/4.3a0
Varun Agrawal 2024-12-07 19:12:06 -05:00
parent 261038f936
commit 20d6d09e06
1 changed files with 5 additions and 5 deletions

View File

@ -55,7 +55,7 @@ namespace gtsam {
DiscreteKeys DiscreteFactorGraph::discreteKeys() const { DiscreteKeys DiscreteFactorGraph::discreteKeys() const {
DiscreteKeys result; DiscreteKeys result;
for (auto&& factor : *this) { for (auto&& factor : *this) {
if (auto p = std::dynamic_pointer_cast<DecisionTreeFactor>(factor)) { if (auto p = std::dynamic_pointer_cast<DiscreteFactor>(factor)) {
DiscreteKeys factor_keys = p->discreteKeys(); DiscreteKeys factor_keys = p->discreteKeys();
result.insert(result.end(), factor_keys.begin(), factor_keys.end()); result.insert(result.end(), factor_keys.begin(), factor_keys.end());
} }
@ -157,7 +157,7 @@ namespace gtsam {
// max out frontals, this is the factor on the separator // max out frontals, this is the factor on the separator
gttic(max); gttic(max);
DecisionTreeFactor::shared_ptr max = product->max(frontalKeys); DiscreteFactor::shared_ptr max = product->max(frontalKeys);
gttoc(max); gttoc(max);
// Ordering keys for the conditional so that frontalKeys are really in front // Ordering keys for the conditional so that frontalKeys are really in front
@ -244,7 +244,7 @@ namespace gtsam {
// sum out frontals, this is the factor on the separator // sum out frontals, this is the factor on the separator
gttic_(sum); gttic_(sum);
DecisionTreeFactor::shared_ptr sum = product->sum(frontalKeys); DiscreteFactor::shared_ptr sum = product->sum(frontalKeys);
gttoc_(sum); gttoc_(sum);
// Ordering keys for the conditional so that frontalKeys are really in front // Ordering keys for the conditional so that frontalKeys are really in front
@ -257,8 +257,8 @@ namespace gtsam {
// now divide product/sum to get conditional // now divide product/sum to get conditional
gttic_(divide); gttic_(divide);
auto conditional = auto conditional =
std::make_shared<DiscreteConditional>(product, *sum, orderedKeys); std::make_shared<DiscreteConditional>(product, sum, orderedKeys);
gttoc_(divide); gttoc(divide);
return {conditional, sum}; return {conditional, sum};
} }