From 77578512f80600d27f25cdfeb0c22526e64ce7b9 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 7 Dec 2024 21:45:22 -0500 Subject: [PATCH] timing --- gtsam/discrete/DiscreteFactorGraph.cpp | 11 +++++------ gtsam/discrete/DiscreteLookupDAG.h | 10 +++++++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/gtsam/discrete/DiscreteFactorGraph.cpp b/gtsam/discrete/DiscreteFactorGraph.cpp index c2a16159b..fa9d9bdc7 100644 --- a/gtsam/discrete/DiscreteFactorGraph.cpp +++ b/gtsam/discrete/DiscreteFactorGraph.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -127,14 +126,14 @@ namespace gtsam { static DiscreteFactor::shared_ptr Normalize( const DiscreteFactor::shared_ptr& product) { // Max over all the potentials by pretending all keys are frontal: - gttic(DiscreteFindMax); + gttic_(DiscreteFindMax); auto normalization = product->max(product->size()); - gttoc(DiscreteFindMax); + gttoc_(DiscreteFindMax); - gttic(DiscreteNormalization); + gttic_(DiscreteNormalization); // Normalize the product factor to prevent underflow. auto normalized_product = product->operator/(normalization); - gttoc(DiscreteNormalization); + gttoc_(DiscreteNormalization); return normalized_product; } @@ -260,7 +259,7 @@ namespace gtsam { gttic_(divide); auto conditional = std::make_shared(product, sum, orderedKeys); - gttoc(divide); + gttoc_(divide); return {conditional, sum}; } diff --git a/gtsam/discrete/DiscreteLookupDAG.h b/gtsam/discrete/DiscreteLookupDAG.h index c811c4c49..21181d374 100644 --- a/gtsam/discrete/DiscreteLookupDAG.h +++ b/gtsam/discrete/DiscreteLookupDAG.h @@ -55,7 +55,15 @@ class GTSAM_EXPORT DiscreteLookupTable : public DiscreteConditional { const ADT& potentials) : DiscreteConditional(nFrontals, keys, potentials) {} - //TODO(Varun): Should accept a DiscreteFactor::shared_ptr + /** + * @brief Construct a new Discrete Lookup Table object + * + * @param nFrontals number of frontal variables + * @param keys a sorted list of gtsam::Keys + * @param potentials Discrete potentials as a TableFactor. + * + * //TODO(Varun): Should accept a DiscreteFactor::shared_ptr + */ DiscreteLookupTable(size_t nFrontals, const DiscreteKeys& keys, const TableFactor& potentials) : DiscreteConditional(nFrontals, keys,