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");
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);