From e22f3893c67c8e95c37f174de26e46ee26ca63d6 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Mon, 13 Dec 2021 19:38:07 -0500 Subject: [PATCH] Added value, for wrapper --- gtsam/discrete/DiscreteFactor.h | 3 +++ gtsam/discrete/DiscreteFactorGraph.h | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gtsam/discrete/DiscreteFactor.h b/gtsam/discrete/DiscreteFactor.h index e2be94b94..edcfcb8a4 100644 --- a/gtsam/discrete/DiscreteFactor.h +++ b/gtsam/discrete/DiscreteFactor.h @@ -83,6 +83,9 @@ public: /// Find value for given assignment of values to variables virtual double operator()(const DiscreteValues&) const = 0; + /// Synonym for operator(), mostly for wrapper + double value(const DiscreteValues& values) const { return operator()(values); } + /// Multiply in a DecisionTreeFactor and return the result as DecisionTreeFactor virtual DecisionTreeFactor operator*(const DecisionTreeFactor&) const = 0; diff --git a/gtsam/discrete/DiscreteFactorGraph.h b/gtsam/discrete/DiscreteFactorGraph.h index a8ba7ab03..06c52dd7b 100644 --- a/gtsam/discrete/DiscreteFactorGraph.h +++ b/gtsam/discrete/DiscreteFactorGraph.h @@ -130,8 +130,14 @@ public: /** return product of all factors as a single factor */ DecisionTreeFactor product() const; - /** Evaluates the factor graph given values, returns the joint probability of the factor graph given specific instantiation of values*/ - double operator()(const DiscreteValues & values) const; + /** + * Evaluates the factor graph given values, returns the joint probability of + * the factor graph given specific instantiation of values + */ + double operator()(const DiscreteValues& values) const; + + /// Synonym for operator(), mostly for wrapper + double value(const DiscreteValues& values) const { return operator()(values); } /// print void print(