new AlgebraicDecisionTree constructor

release/4.3a0
Varun Agrawal 2024-10-08 15:09:21 -04:00
parent 34bb1d0f34
commit a9ffbf5299
1 changed files with 15 additions and 0 deletions

View File

@ -182,6 +182,21 @@ namespace gtsam {
this->root_ = DecisionTree<L, double>::convertFrom(other.root_, L_of_M, op);
}
/**
* @brief Create from an arbitrary DecisionTree<L, X> by operating on it
* with a functional `f`.
*
* @tparam X The type of the leaf of the original DecisionTree
* @tparam Func Type signature of functional `f`.
* @param other The original DecisionTree from which the
* AlgbraicDecisionTree is constructed.
* @param f Functional used to operate on
* the leaves of the input DecisionTree.
*/
template <typename X, typename Func>
AlgebraicDecisionTree(const DecisionTree<L, X>& other, Func f)
: Base(other, f) {}
/** sum */
AlgebraicDecisionTree operator+(const AlgebraicDecisionTree& g) const {
return this->apply(g, &Ring::add);