DecisionTreeFactor apply methods

release/4.3a0
Varun Agrawal 2023-07-22 00:50:33 -04:00
parent c8e9a57cac
commit 2b85cfedd4
2 changed files with 28 additions and 2 deletions

View File

@ -82,6 +82,22 @@ namespace gtsam {
ADT::print("", formatter); ADT::print("", formatter);
} }
/* ************************************************************************ */
DecisionTreeFactor DecisionTreeFactor::apply(ADT::Unary op) const {
// apply operand
ADT result = ADT::apply(op);
// Make a new factor
return DecisionTreeFactor(discreteKeys(), result);
}
/* ************************************************************************ */
DecisionTreeFactor DecisionTreeFactor::apply(ADT::UnaryAssignment op) const {
// apply operand
ADT result = ADT::apply(op);
// Make a new factor
return DecisionTreeFactor(discreteKeys(), result);
}
/* ************************************************************************ */ /* ************************************************************************ */
DecisionTreeFactor DecisionTreeFactor::apply(const DecisionTreeFactor& f, DecisionTreeFactor DecisionTreeFactor::apply(const DecisionTreeFactor& f,
ADT::Binary op) const { ADT::Binary op) const {

View File

@ -147,8 +147,18 @@ 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::Unary op) const;
/**
* Apply unary operator (*this) "op" f
* @param op a unary operator that operates on AlgebraicDecisionTree. Takes
* both the assignment and the value.
*/
DecisionTreeFactor apply(ADT::UnaryAssignment op) const;
/** /**
* Apply binary operator (*this) "op" f * Apply binary operator (*this) "op" f