36 template<
class FACTOR>
37 std::pair<std::shared_ptr<SymbolicConditional>, std::shared_ptr<SymbolicFactor> >
44 for(
const std::shared_ptr<FACTOR>& factor: factors) {
47 allKeys.insert(factor->begin(), factor->end());
52 if(allKeys.find(key) == allKeys.end())
53 throw std::runtime_error(
"Requested to eliminate a key that is not in the factors");
57 KeySet frontals(keys);
58 const size_t nFrontals = keys.size();
62 std::copy(keys.begin(), keys.end(), orderedKeys.begin());
63 std::set_difference(allKeys.begin(), allKeys.end(), frontals.begin(), frontals.end(), orderedKeys.begin() + nFrontals);
The base class for all factors.
std::pair< std::shared_ptr< SymbolicConditional >, std::shared_ptr< SymbolicFactor > > EliminateSymbolic(const FactorGraph< FACTOR > &factors, const Ordering &keys)
Implementation of dense elimination function for symbolic factors.
Definition SymbolicFactor-inst.h:38
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:91
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:43
A factor graph is a bipartite graph with factor nodes connected to variable nodes.
Definition FactorGraph.h:58
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:118