26class EliminationTreeTester;
50 template<
class BAYESNET,
class GRAPH>
64 typedef typename GRAPH::Eliminate Eliminate;
74 sharedFactor eliminate(
const std::shared_ptr<BayesNetType>& output,
77 void print(
const std::string& str,
const KeyFormatter& keyFormatter)
const;
132 std::pair<std::shared_ptr<BayesNetType>, std::shared_ptr<FactorGraphType> >
140 void print(
const std::string& name =
"EliminationTree: ",
168 friend class ::EliminationTreeTester;
A thin wrapper around std::vector that uses a custom allocator.
Concept check for values that can be used in unit tests.
std::vector< T, typename internal::FastDefaultVectorAllocator< T >::type > FastVector
FastVector is a type alias to a std::vector with a custom memory allocator.
Definition FastVector.h:33
Global functions in a separate testing namespace.
Definition chartTesting.h:28
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition Key.cpp:30
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition Key.h:35
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:43
bool equals(const This &other, double tol=1e-9) const
Test whether the tree is equal to another.
Definition EliminationTree-inst.h:251
void print(const std::string &name="EliminationTree: ", const KeyFormatter &formatter=DefaultKeyFormatter) const
Print the tree to cout.
Definition EliminationTree-inst.h:244
This & operator=(const This &other)
Assignment operator - makes a deep copy of the tree structure, but only pointers to factors are copie...
Definition EliminationTree-inst.h:173
EliminationTree< DiscreteBayesNet, DiscreteFactorGraph > This
Definition EliminationTree.h:54
~EliminationTree()
Destructor Using default destructor causes stack overflow for large trees due to recursive destructio...
Definition EliminationTree-inst.h:193
FastVector< sharedNode > roots_
Definition EliminationTree.h:86
std::shared_ptr< This > shared_ptr
Definition EliminationTree.h:55
DiscreteBayesNet BayesNetType
Definition EliminationTree.h:61
const FastVector< sharedNode > & roots() const
Return the set of roots (one for a tree, multiple for a forest).
Definition EliminationTree.h:154
std::shared_ptr< FactorType > sharedFactor
Definition EliminationTree.h:60
std::shared_ptr< Node > sharedNode
Definition EliminationTree.h:80
DiscreteFactorGraph FactorGraphType
Definition EliminationTree.h:58
void swap(This &other)
Swap the data of this tree with another one, this operation is very fast.
Definition EliminationTree-inst.h:320
std::pair< std::shared_ptr< BayesNetType >, std::shared_ptr< FactorGraphType > > eliminate(Eliminate function) const
Eliminate the factors to a Bayes net and remaining factor graph.
Definition EliminationTree-inst.h:224
EliminationTree()
Protected default constructor.
Definition EliminationTree.h:164
BayesNetType::ConditionalType ConditionalType
Definition EliminationTree.h:62
DiscreteFactorGraph::FactorType FactorType
Definition EliminationTree.h:59
std::shared_ptr< ConditionalType > sharedConditional
Definition EliminationTree.h:63
EliminationTree(const FactorGraphType &factorGraph, const VariableIndex &structure, const Ordering &order)
Build the elimination tree of a factor graph using pre-computed column structure.
Definition EliminationTree-inst.h:78
const FastVector< sharedFactor > & remainingFactors() const
Return the remaining factors that are not pulled into elimination.
Definition EliminationTree.h:157
Definition EliminationTree.h:66
Key key
key associated with root
Definition EliminationTree.h:70
Children children
sub-trees
Definition EliminationTree.h:72
Factors factors
factors associated with root
Definition EliminationTree.h:71
The VariableIndex class computes and stores the block column structure of a factor graph.
Definition VariableIndex.h:41