From 1d7918841797e3e970587cbec1c60aeaafa21566 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 7 Dec 2024 19:40:20 -0500 Subject: [PATCH] compiles --- gtsam/discrete/DiscreteFactorGraph.cpp | 6 ++++-- gtsam/discrete/DiscreteLookupDAG.h | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gtsam/discrete/DiscreteFactorGraph.cpp b/gtsam/discrete/DiscreteFactorGraph.cpp index a4f92e267..c2a16159b 100644 --- a/gtsam/discrete/DiscreteFactorGraph.cpp +++ b/gtsam/discrete/DiscreteFactorGraph.cpp @@ -170,8 +170,10 @@ namespace gtsam { // Make lookup with product gttic(lookup); size_t nrFrontals = frontalKeys.size(); - auto lookup = std::make_shared(nrFrontals, - orderedKeys, product); + //TODO(Varun): Should accept a DiscreteFactor::shared_ptr + auto lookup = std::make_shared( + nrFrontals, orderedKeys, + *std::dynamic_pointer_cast(product)); gttoc(lookup); return {std::dynamic_pointer_cast(lookup), max}; diff --git a/gtsam/discrete/DiscreteLookupDAG.h b/gtsam/discrete/DiscreteLookupDAG.h index f077a13d9..c811c4c49 100644 --- a/gtsam/discrete/DiscreteLookupDAG.h +++ b/gtsam/discrete/DiscreteLookupDAG.h @@ -18,6 +18,7 @@ #pragma once #include +#include #include #include @@ -54,6 +55,12 @@ class GTSAM_EXPORT DiscreteLookupTable : public DiscreteConditional { const ADT& potentials) : DiscreteConditional(nFrontals, keys, potentials) {} + //TODO(Varun): Should accept a DiscreteFactor::shared_ptr + DiscreteLookupTable(size_t nFrontals, const DiscreteKeys& keys, + const TableFactor& potentials) + : DiscreteConditional(nFrontals, keys, + potentials.toDecisionTreeFactor()) {} + /// GTSAM-style print void print( const std::string& s = "Discrete Lookup Table: ",