From a9ffbf5299c36f8a8e92d2335ed8e6f73fc30b12 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Tue, 8 Oct 2024 15:09:21 -0400 Subject: [PATCH] new AlgebraicDecisionTree constructor --- gtsam/discrete/AlgebraicDecisionTree.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gtsam/discrete/AlgebraicDecisionTree.h b/gtsam/discrete/AlgebraicDecisionTree.h index 6001b1983..45b949d3c 100644 --- a/gtsam/discrete/AlgebraicDecisionTree.h +++ b/gtsam/discrete/AlgebraicDecisionTree.h @@ -182,6 +182,21 @@ namespace gtsam { this->root_ = DecisionTree::convertFrom(other.root_, L_of_M, op); } + /** + * @brief Create from an arbitrary DecisionTree 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 + AlgebraicDecisionTree(const DecisionTree& other, Func f) + : Base(other, f) {} + /** sum */ AlgebraicDecisionTree operator+(const AlgebraicDecisionTree& g) const { return this->apply(g, &Ring::add);