update DecisionTreeFactor.h

release/4.3a0
Varun Agrawal 2024-12-08 11:51:55 -05:00
parent 9b93411d69
commit 7bf8ee167d
1 changed files with 7 additions and 6 deletions

View File

@ -21,11 +21,12 @@
#include <gtsam/discrete/AlgebraicDecisionTree.h> #include <gtsam/discrete/AlgebraicDecisionTree.h>
#include <gtsam/discrete/DiscreteFactor.h> #include <gtsam/discrete/DiscreteFactor.h>
#include <gtsam/discrete/DiscreteKey.h> #include <gtsam/discrete/DiscreteKey.h>
#include <gtsam/discrete/Ring.h>
#include <gtsam/inference/Ordering.h> #include <gtsam/inference/Ordering.h>
#include <algorithm> #include <algorithm>
#include <memory>
#include <map> #include <map>
#include <memory>
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
#include <utility> #include <utility>
@ -145,7 +146,7 @@ namespace gtsam {
/// multiply two factors /// multiply two factors
DecisionTreeFactor operator*(const DecisionTreeFactor& f) const override { DecisionTreeFactor operator*(const DecisionTreeFactor& f) const override {
return apply(f, ADT::Ring::mul); return apply(f, Ring::mul);
} }
static double safe_div(const double& a, const double& b); static double safe_div(const double& a, const double& b);
@ -160,22 +161,22 @@ namespace gtsam {
/// Create new factor by summing all values with the same separator values /// Create new factor by summing all values with the same separator values
shared_ptr sum(size_t nrFrontals) const { shared_ptr sum(size_t nrFrontals) const {
return combine(nrFrontals, ADT::Ring::add); return combine(nrFrontals, Ring::add);
} }
/// Create new factor by summing all values with the same separator values /// Create new factor by summing all values with the same separator values
shared_ptr sum(const Ordering& keys) const { shared_ptr sum(const Ordering& keys) const {
return combine(keys, ADT::Ring::add); return combine(keys, Ring::add);
} }
/// Create new factor by maximizing over all values with the same separator. /// Create new factor by maximizing over all values with the same separator.
shared_ptr max(size_t nrFrontals) const { shared_ptr max(size_t nrFrontals) const {
return combine(nrFrontals, ADT::Ring::max); return combine(nrFrontals, Ring::max);
} }
/// Create new factor by maximizing over all values with the same separator. /// Create new factor by maximizing over all values with the same separator.
shared_ptr max(const Ordering& keys) const { shared_ptr max(const Ordering& keys) const {
return combine(keys, ADT::Ring::max); return combine(keys, Ring::max);
} }
/// @} /// @}