2009-10-29 13:39:13 +08:00
|
|
|
/*
|
|
|
|
* SymbolicFactorGraph.cpp
|
|
|
|
*
|
|
|
|
* Created on: Oct 29, 2009
|
|
|
|
* Author: Frank Dellaert
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <boost/foreach.hpp>
|
2009-10-30 11:48:32 +08:00
|
|
|
#include "Ordering.h"
|
2009-10-30 13:45:22 +08:00
|
|
|
#include "FactorGraph-inl.h"
|
2009-10-29 13:39:13 +08:00
|
|
|
#include "SymbolicFactorGraph.h"
|
2009-11-01 03:53:20 +08:00
|
|
|
#include "SymbolicBayesNet.h"
|
2009-10-29 13:39:13 +08:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
namespace gtsam {
|
|
|
|
|
2009-10-30 13:45:22 +08:00
|
|
|
// Explicitly instantiate so we don't have to include everywhere
|
|
|
|
template class FactorGraph<SymbolicFactor>;
|
|
|
|
|
2009-10-29 13:39:13 +08:00
|
|
|
/* ************************************************************************* */
|
2009-11-01 03:53:20 +08:00
|
|
|
SymbolicBayesNet::shared_ptr
|
2009-10-30 11:48:32 +08:00
|
|
|
SymbolicFactorGraph::eliminate(const Ordering& ordering)
|
2009-10-29 22:34:34 +08:00
|
|
|
{
|
2009-11-02 11:50:30 +08:00
|
|
|
SymbolicBayesNet::shared_ptr bayesNet (new SymbolicBayesNet());
|
2009-10-29 22:34:34 +08:00
|
|
|
|
2009-10-30 11:48:32 +08:00
|
|
|
BOOST_FOREACH(string key, ordering) {
|
|
|
|
SymbolicConditional::shared_ptr conditional = eliminateOne<SymbolicConditional>(key);
|
2009-11-02 13:17:44 +08:00
|
|
|
bayesNet->push_back(conditional);
|
2009-10-30 11:48:32 +08:00
|
|
|
}
|
2009-10-29 22:34:34 +08:00
|
|
|
|
2009-11-02 11:50:30 +08:00
|
|
|
return bayesNet;
|
2009-10-29 22:34:34 +08:00
|
|
|
}
|
|
|
|
|
2009-10-29 13:39:13 +08:00
|
|
|
/* ************************************************************************* */
|
|
|
|
|
|
|
|
}
|