From 8fefbbf06a751bdd9e637f72571229145be77b13 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sun, 15 Dec 2024 16:03:10 -0500 Subject: [PATCH] fix toDecisionTreeFactor so the keys are ordered correctly --- gtsam/discrete/TableFactor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gtsam/discrete/TableFactor.cpp b/gtsam/discrete/TableFactor.cpp index 521ca4d47..63e9e5d6b 100644 --- a/gtsam/discrete/TableFactor.cpp +++ b/gtsam/discrete/TableFactor.cpp @@ -153,8 +153,7 @@ TableFactor::TableFactor(const DiscreteKeys& dkeys, /* ************************************************************************ */ TableFactor::TableFactor(const DecisionTreeFactor& dtf) - : TableFactor(dtf.discreteKeys(), - ComputeSparseTable(dtf.discreteKeys(), dtf)) {} + : TableFactor(dtf.discreteKeys(), dtf) {} /* ************************************************************************ */ TableFactor::TableFactor(const DiscreteConditional& c) @@ -278,7 +277,8 @@ DecisionTreeFactor TableFactor::toDecisionTreeFactor() const { table.push_back(pair.second); }); - DecisionTreeFactor f(rdkeys, table); + AlgebraicDecisionTree tree(rdkeys, table); + DecisionTreeFactor f(dkeys, tree); return f; }