/* ---------------------------------------------------------------------------- * GTSAM Copyright 2010, Georgia Tech Research Corporation, * Atlanta, Georgia 30332-0415 * All Rights Reserved * Authors: Frank Dellaert, et al. (see THANKS for the full author list) * See LICENSE for the license information * -------------------------------------------------------------------------- */ /* * SymbolicFactorGraph.cpp * * Created on: Oct 29, 2009 * Author: Frank Dellaert */ #include #include #include #include #include #include #include #include #include using namespace std; namespace gtsam { // Explicitly instantiate so we don't have to include everywhere template class FactorGraph; template class BayesNet; template class EliminationTree; /* ************************************************************************* */ SymbolicFactorGraph::SymbolicFactorGraph(const BayesNet& bayesNet) : FactorGraph(bayesNet) {} /* ************************************************************************* */ void SymbolicFactorGraph::push_factor(Index key) { boost::shared_ptr factor(new IndexFactor(key)); push_back(factor); } /** Push back binary factor */ void SymbolicFactorGraph::push_factor(Index key1, Index key2) { boost::shared_ptr factor(new IndexFactor(key1,key2)); push_back(factor); } /** Push back ternary factor */ void SymbolicFactorGraph::push_factor(Index key1, Index key2, Index key3) { boost::shared_ptr factor(new IndexFactor(key1,key2,key3)); push_back(factor); } /** Push back 4-way factor */ void SymbolicFactorGraph::push_factor(Index key1, Index key2, Index key3, Index key4) { boost::shared_ptr factor(new IndexFactor(key1,key2,key3,key4)); push_back(factor); } /* ************************************************************************* */ std::set, boost::fast_pool_allocator > SymbolicFactorGraph::keys() const { std::set, boost::fast_pool_allocator > keys; BOOST_FOREACH(const sharedFactor& factor, *this) { if(factor) keys.insert(factor->begin(), factor->end()); } return keys; } // /* ************************************************************************* */ // SymbolicBayesNet // SymbolicFactorGraph::eliminateFrontals(const Ordering& ordering) // { // return Inference::Eliminate(ordering); // } /* ************************************************************************* */ }