29#include <unordered_set>
71 template <
typename GRAPH>
73 const std::unordered_set<Key>& fixedKeys = {})
77 template <
typename GRAPH>
78 static SymbolicFactorGraph buildIndexedSymbolicFactorGraph(
79 const GRAPH& graph,
const std::unordered_set<Key>& fixedKeys) {
80 SymbolicFactorGraph symbolicGraph;
81 symbolicGraph.reserve(graph.size());
82 for (
size_t i = 0; i < graph.size(); ++i) {
83 if (!graph.at(i))
continue;
85 keys.reserve(graph[i]->size());
86 for (Key key : graph[i]->keys()) {
87 if (!fixedKeys.count(key)) keys.push_back(key);
90 if (keys.empty())
continue;
91 symbolicGraph.emplace_shared<internal::IndexedSymbolicFactor>(keys, i);
96 template <
typename GRAPH>
97 static SymbolicEliminationTree makeIndexedEliminationTree(
98 const GRAPH& graph,
const Ordering& ordering,
99 const std::unordered_set<Key>& fixedKeys) {
100 SymbolicFactorGraph symbolicGraph =
101 buildIndexedSymbolicFactorGraph(graph, fixedKeys);
102 return SymbolicEliminationTree(std::move(symbolicGraph), ordering);
Typedefs for easier changing of types.
Variable ordering for the elimination algorithm.
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
const KeyVector & keys() const
Access the factor's involved variable keys.
Definition Factor.h:143
KeyVector keys_
The keys involved in this factor.
Definition Factor.h:88
SymbolicJunctionTree(const SymbolicEliminationTree &eliminationTree)
Build the elimination tree of a factor graph using pre-computed column structure.
Definition SymbolicJunctionTree.cpp:30
IndexedJunctionTree(const GRAPH &graph, const Ordering &ordering, const std::unordered_set< Key > &fixedKeys={})
Construct an IndexedJunctionTree from any factor graph, ordering, and optional set of fixed keys to f...
Definition IndexedJunctionTree.h:72
SymbolicFactor()
Default constructor for I/O.
Definition SymbolicFactor.h:53
A EliminatableClusterTree, i.e., a set of variable clusters with factors, arranged in a tree,...
Definition SymbolicJunctionTree.h:51
SymbolicJunctionTree(const SymbolicEliminationTree &eliminationTree)
Build the elimination tree of a factor graph using pre-computed column structure.
Definition SymbolicJunctionTree.cpp:30