diff --git a/inference/EliminationTree-inl.h b/inference/EliminationTree-inl.h index 1271f0150..43e0e3e90 100644 --- a/inference/EliminationTree-inl.h +++ b/inference/EliminationTree-inl.h @@ -9,6 +9,7 @@ #pragma once #include +#include #include #include "EliminationTree.h" @@ -52,9 +53,12 @@ namespace gtsam { EliminationTree::EliminationTree(const OrderedGraphs& graphs) : nrVariables_(graphs.size()), nodes_(nrVariables_) { - // Create a temporary map from key to ordering index + // Get ordering by (map first graphs) Ordering ordering; - transform(graphs.begin(), graphs.end(), std::back_inserter(ordering), getName); + transform(graphs.begin(), graphs.end(), back_inserter(ordering), + _Select1st ()); + + // Create a temporary map from key to ordering index IndexTable indexTable(ordering); // Go over the collection in reverse elimination order @@ -68,7 +72,7 @@ namespace gtsam { EliminationTree::EliminationTree(FG& fg, const Ordering& ordering) : nrVariables_(ordering.size()), nodes_(nrVariables_) { - // Loop over all variables and get factors that have it + // Loop over all variables and get factors that are connected OrderedGraphs graphs; BOOST_FOREACH(const Symbol& key, ordering) { // TODO: a collection of factors is a factor graph and this should be returned diff --git a/inference/EliminationTree.h b/inference/EliminationTree.h index dff2e8873..2fca9d05d 100644 --- a/inference/EliminationTree.h +++ b/inference/EliminationTree.h @@ -17,7 +17,7 @@ namespace gtsam { /** * An elimination tree (see Gilbert01bit) associated with a factorg raph and an ordering * is a cluster-tree where there is one node j for each variable, and the parent of each node - * corresponds to the first variable in the ordering that variable j is connected to. + * corresponds to the first variable up the ordering in the Cholesky factor that j is connected to. */ template class EliminationTree: public ClusterTree { @@ -41,10 +41,6 @@ namespace gtsam { typedef std::vector Nodes; Nodes nodes_; - static inline Symbol getName(const NamedGraph& namedGraph) { - return namedGraph.first; - } - /** * add a factor graph fragment with given frontal key into the tree. Assumes * parent node was already added (will throw exception if not).