avoid keys() call to known set of keys

release/4.3a0
Frank Dellaert 2010-02-21 15:24:05 +00:00
parent 190ec53a63
commit fe4471930f
2 changed files with 6 additions and 5 deletions

View File

@ -255,7 +255,7 @@ namespace gtsam {
/* ************************************************************************* */
template<class Conditional>
template<class Factor>
FactorGraph<Factor>
pair<FactorGraph<Factor>, Ordering>
BayesTree<Conditional>::Clique::joint(shared_ptr C2, shared_ptr R) {
// For now, assume neither is the root
@ -273,7 +273,7 @@ namespace gtsam {
keys12.unique();
// Calculate the marginal
return marginalize<Factor,Conditional>(*bn,keys12);
return make_pair(marginalize<Factor,Conditional>(*bn,keys12), keys12);
}
/* ************************************************************************* */
@ -500,10 +500,11 @@ namespace gtsam {
sharedClique C1 = (*this)[key1], C2 = (*this)[key2];
// calculate joint
FactorGraph<Factor> p_C1C2 = C1->joint<Factor>(C2,root_);
Ordering ord;
FactorGraph<Factor> p_C1C2;
boost::tie(p_C1C2,ord) = C1->joint<Factor>(C2,root_);
// create an ordering where both requested keys are not eliminated
Ordering ord = p_C1C2.keys();
ord.remove(key1);
ord.remove(key2);

View File

@ -84,7 +84,7 @@ namespace gtsam {
/** return the joint P(C1,C2), where C1==this. TODO: not a method? */
template<class Factor>
FactorGraph<Factor> joint(shared_ptr C2, shared_ptr root);
std::pair<FactorGraph<Factor>,Ordering> joint(shared_ptr C2, shared_ptr root);
};
// typedef for shared pointers to cliques