26#include <boost/shared_ptr.hpp>
27#include <boost/make_shared.hpp>
37 template<
class FACTOR>
38 std::pair<boost::shared_ptr<SymbolicConditional>, boost::shared_ptr<SymbolicFactor> >
45 for(
const boost::shared_ptr<FACTOR>& factor: factors) {
46 allKeys.insert(factor->begin(), factor->end());
51 if(allKeys.find(key) == allKeys.end())
52 throw std::runtime_error(
"Requested to eliminate a key that is not in the factors");
57 const size_t nFrontals = keys.size();
61 std::copy(keys.begin(), keys.end(), orderedKeys.begin());
62 std::set_difference(allKeys.begin(), allKeys.end(), frontals.begin(), frontals.end(), orderedKeys.begin() + nFrontals);
65 return std::make_pair(
The base class for all factors.
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:86
std::pair< boost::shared_ptr< SymbolicConditional >, boost::shared_ptr< SymbolicFactor > > EliminateSymbolic(const SymbolicFactorGraph &factors, const Ordering &keys)
Dense elimination function for symbolic factors.
Definition: SymbolicFactor.cpp:31
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:69
A factor graph is a bipartite graph with factor nodes connected to variable nodes.
Definition: FactorGraph.h:93
Definition: Ordering.h:34
static SymbolicConditional::shared_ptr FromKeysShared(const CONTAINER &keys, size_t nrFrontals)
Named constructor from an arbitrary number of keys and frontals.
Definition: SymbolicConditional.h:94
static SymbolicFactor::shared_ptr FromIteratorsShared(KEYITERATOR beginKey, KEYITERATOR endKey)
Constructor from a collection of keys.
Definition: SymbolicFactor.h:122