Cliques class
parent
7ce62f1626
commit
6f11c0803b
|
@ -348,11 +348,11 @@ namespace gtsam {
|
|||
/* ************************************************************************* */
|
||||
template<class Conditional>
|
||||
template<class Factor>
|
||||
pair<FactorGraph<Factor>, list<typename BayesTree<Conditional>::sharedClique> >
|
||||
pair<FactorGraph<Factor>, typename BayesTree<Conditional>::Cliques>
|
||||
BayesTree<Conditional>::removePath(sharedClique clique) {
|
||||
|
||||
FactorGraph<Factor> factors;
|
||||
list<sharedClique> orphans;
|
||||
Cliques orphans;
|
||||
|
||||
// base case is NULL, if so we do nothing and return empties above
|
||||
if (clique!=NULL) {
|
||||
|
|
|
@ -81,8 +81,15 @@ namespace gtsam {
|
|||
FactorGraph<Factor> joint(shared_ptr C2, shared_ptr root);
|
||||
};
|
||||
|
||||
// typedef for shared pointers to cliques
|
||||
typedef boost::shared_ptr<Clique> sharedClique;
|
||||
|
||||
// A convenience class for a list of shared cliques
|
||||
struct Cliques : public std::list<sharedClique>, public Testable<Cliques> {
|
||||
void print(const std::string& s = "") const {}
|
||||
bool equals(const Cliques& other, double tol = 1e-9) const { return false; }
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
/** Map from keys to Clique */
|
||||
|
@ -157,7 +164,7 @@ namespace gtsam {
|
|||
|
||||
/** Remove path from clique to root and return that path as factors plus a list of orphaned subtree roots */
|
||||
template<class Factor>
|
||||
std::pair<FactorGraph<Factor>, std::list<sharedClique> > removePath(sharedClique clique);
|
||||
std::pair<FactorGraph<Factor>, Cliques> removePath(sharedClique clique);
|
||||
|
||||
}; // BayesTree
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ TEST( BayesTree, removePath )
|
|||
expected.push_factor("A","C");
|
||||
|
||||
FactorGraph<SymbolicFactor> factors;
|
||||
list<SymbolicBayesTree::sharedClique> orphans;
|
||||
SymbolicBayesTree::Cliques orphans;
|
||||
boost::tie(factors,orphans) = bayesTree.removePath<SymbolicFactor>(bayesTree["C"]);
|
||||
CHECK(assert_equal((FactorGraph<SymbolicFactor>)expected, factors));
|
||||
|
||||
|
|
Loading…
Reference in New Issue