diff --git a/cpp/BayesTree-inl.h b/cpp/BayesTree-inl.h index a41965b20..5a80a3eae 100644 --- a/cpp/BayesTree-inl.h +++ b/cpp/BayesTree-inl.h @@ -255,7 +255,7 @@ namespace gtsam { /* ************************************************************************* */ template template - FactorGraph + pair, Ordering> BayesTree::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(*bn,keys12); + return make_pair(marginalize(*bn,keys12), keys12); } /* ************************************************************************* */ @@ -500,10 +500,11 @@ namespace gtsam { sharedClique C1 = (*this)[key1], C2 = (*this)[key2]; // calculate joint - FactorGraph p_C1C2 = C1->joint(C2,root_); + Ordering ord; + FactorGraph p_C1C2; + boost::tie(p_C1C2,ord) = C1->joint(C2,root_); // create an ordering where both requested keys are not eliminated - Ordering ord = p_C1C2.keys(); ord.remove(key1); ord.remove(key2); diff --git a/cpp/BayesTree.h b/cpp/BayesTree.h index 6b6b462b3..c4ef2d53f 100644 --- a/cpp/BayesTree.h +++ b/cpp/BayesTree.h @@ -84,7 +84,7 @@ namespace gtsam { /** return the joint P(C1,C2), where C1==this. TODO: not a method? */ template - FactorGraph joint(shared_ptr C2, shared_ptr root); + std::pair,Ordering> joint(shared_ptr C2, shared_ptr root); }; // typedef for shared pointers to cliques