From 94f21358f4725b3ebc2afcfacf2a42ffe9b08358 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Wed, 29 Dec 2021 13:31:06 -0500 Subject: [PATCH] fix decision tree equality and move default constructor to public --- gtsam/discrete/DecisionTree-inl.h | 2 +- gtsam/discrete/DecisionTree.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gtsam/discrete/DecisionTree-inl.h b/gtsam/discrete/DecisionTree-inl.h index f6a64f11f..3bd2ac113 100644 --- a/gtsam/discrete/DecisionTree-inl.h +++ b/gtsam/discrete/DecisionTree-inl.h @@ -79,7 +79,7 @@ namespace gtsam { bool equals(const Node& q, double tol) const override { const Leaf* other = dynamic_cast (&q); if (!other) return false; - return std::abs(double(this->constant_ - other->constant_)) < tol; + return this->constant_ == other->constant_; } /** print */ diff --git a/gtsam/discrete/DecisionTree.h b/gtsam/discrete/DecisionTree.h index 0a78d4635..1e2c8b509 100644 --- a/gtsam/discrete/DecisionTree.h +++ b/gtsam/discrete/DecisionTree.h @@ -113,14 +113,14 @@ namespace gtsam { convert(const typename DecisionTree::NodePtr& f, const std::map& map, std::function op); - /** Default constructor */ - DecisionTree(); - public: /// @name Standard Constructors /// @{ + /** Default constructor (for serialization) */ + DecisionTree(); + /** Create a constant */ DecisionTree(const Y& y);