functional

release/4.3a0
Frank Dellaert 2010-07-15 01:41:26 +00:00
parent 4ffc55d8a2
commit d73ae62d78
2 changed files with 8 additions and 8 deletions

View File

@ -9,6 +9,7 @@
#pragma once
#include <stdexcept>
#include <functional>
#include <boost/foreach.hpp>
#include "EliminationTree.h"
@ -52,9 +53,12 @@ namespace gtsam {
EliminationTree<FG>::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<typename OrderedGraphs::value_type> ());
// Create a temporary map from key to ordering index
IndexTable<Symbol> indexTable(ordering);
// Go over the collection in reverse elimination order
@ -68,7 +72,7 @@ namespace gtsam {
EliminationTree<FG>::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

View File

@ -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 FG>
class EliminationTree: public ClusterTree<FG> {
@ -41,10 +41,6 @@ namespace gtsam {
typedef std::vector<sharedNode> 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).