overload apply method in DecisionTreeFactor

release/4.3a0
Varun Agrawal 2023-07-06 16:37:22 -04:00
parent 6d69ca16da
commit f751a5bfcf
2 changed files with 13 additions and 2 deletions

View File

@ -101,6 +101,14 @@ namespace gtsam {
return DecisionTreeFactor(keys, result); return DecisionTreeFactor(keys, result);
} }
/* ************************************************************************ */
DecisionTreeFactor DecisionTreeFactor::apply(ADT::UnaryAssignment op) const {
// apply operand
ADT result = ADT::apply(op);
// Make a new factor
return DecisionTreeFactor(discreteKeys(), result);
}
/* ************************************************************************ */ /* ************************************************************************ */
DecisionTreeFactor::shared_ptr DecisionTreeFactor::combine( DecisionTreeFactor::shared_ptr DecisionTreeFactor::combine(
size_t nrFrontals, ADT::Binary op) const { size_t nrFrontals, ADT::Binary op) const {

View File

@ -147,8 +147,11 @@ namespace gtsam {
/// @name Advanced Interface /// @name Advanced Interface
/// @{ /// @{
/// Inherit all the `apply` methods from AlgebraicDecisionTree /**
using ADT::apply; * Apply unary operator (*this) "op" f
* @param op a unary operator that operates on AlgebraicDecisionTree
*/
DecisionTreeFactor apply(ADT::UnaryAssignment op) const;
/** /**
* Apply binary operator (*this) "op" f * Apply binary operator (*this) "op" f