Cliques class
parent
7ce62f1626
commit
6f11c0803b
|
@ -348,11 +348,11 @@ namespace gtsam {
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
template<class Conditional>
|
template<class Conditional>
|
||||||
template<class Factor>
|
template<class Factor>
|
||||||
pair<FactorGraph<Factor>, list<typename BayesTree<Conditional>::sharedClique> >
|
pair<FactorGraph<Factor>, typename BayesTree<Conditional>::Cliques>
|
||||||
BayesTree<Conditional>::removePath(sharedClique clique) {
|
BayesTree<Conditional>::removePath(sharedClique clique) {
|
||||||
|
|
||||||
FactorGraph<Factor> factors;
|
FactorGraph<Factor> factors;
|
||||||
list<sharedClique> orphans;
|
Cliques orphans;
|
||||||
|
|
||||||
// base case is NULL, if so we do nothing and return empties above
|
// base case is NULL, if so we do nothing and return empties above
|
||||||
if (clique!=NULL) {
|
if (clique!=NULL) {
|
||||||
|
|
|
@ -79,10 +79,17 @@ namespace gtsam {
|
||||||
/** return the joint P(C1,C2), where C1==this. TODO: not a method? */
|
/** return the joint P(C1,C2), where C1==this. TODO: not a method? */
|
||||||
template<class Factor>
|
template<class Factor>
|
||||||
FactorGraph<Factor> joint(shared_ptr C2, shared_ptr root);
|
FactorGraph<Factor> joint(shared_ptr C2, shared_ptr root);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// typedef for shared pointers to cliques
|
||||||
typedef boost::shared_ptr<Clique> sharedClique;
|
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:
|
private:
|
||||||
|
|
||||||
/** Map from keys to Clique */
|
/** 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 */
|
/** Remove path from clique to root and return that path as factors plus a list of orphaned subtree roots */
|
||||||
template<class Factor>
|
template<class Factor>
|
||||||
std::pair<FactorGraph<Factor>, std::list<sharedClique> > removePath(sharedClique clique);
|
std::pair<FactorGraph<Factor>, Cliques> removePath(sharedClique clique);
|
||||||
|
|
||||||
}; // BayesTree
|
}; // BayesTree
|
||||||
|
|
||||||
|
|
|
@ -333,7 +333,7 @@ TEST( BayesTree, removePath )
|
||||||
expected.push_factor("A","C");
|
expected.push_factor("A","C");
|
||||||
|
|
||||||
FactorGraph<SymbolicFactor> factors;
|
FactorGraph<SymbolicFactor> factors;
|
||||||
list<SymbolicBayesTree::sharedClique> orphans;
|
SymbolicBayesTree::Cliques orphans;
|
||||||
boost::tie(factors,orphans) = bayesTree.removePath<SymbolicFactor>(bayesTree["C"]);
|
boost::tie(factors,orphans) = bayesTree.removePath<SymbolicFactor>(bayesTree["C"]);
|
||||||
CHECK(assert_equal((FactorGraph<SymbolicFactor>)expected, factors));
|
CHECK(assert_equal((FactorGraph<SymbolicFactor>)expected, factors));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue