new AlgebraicDecisionTree constructor
parent
34bb1d0f34
commit
a9ffbf5299
|
@ -182,6 +182,21 @@ namespace gtsam {
|
||||||
this->root_ = DecisionTree<L, double>::convertFrom(other.root_, L_of_M, op);
|
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 */
|
/** sum */
|
||||||
AlgebraicDecisionTree operator+(const AlgebraicDecisionTree& g) const {
|
AlgebraicDecisionTree operator+(const AlgebraicDecisionTree& g) const {
|
||||||
return this->apply(g, &Ring::add);
|
return this->apply(g, &Ring::add);
|
||||||
|
|
Loading…
Reference in New Issue