diff --git a/gtsam/inference/BayesTree-inl.h b/gtsam/inference/BayesTree-inl.h index 9df47af2c..2afc88e8a 100644 --- a/gtsam/inference/BayesTree-inl.h +++ b/gtsam/inference/BayesTree-inl.h @@ -565,6 +565,7 @@ namespace gtsam { typename FactorGraph::shared_ptr BayesTree::joint(Index j1, Index j2, Eliminate function) const { +#ifdef SHORTCUT_JOINTS // get clique C1 and C2 sharedClique C1 = (*this)[j1], C2 = (*this)[j2]; @@ -575,6 +576,13 @@ namespace gtsam { std::vector j12(2); j12[0] = j1; j12[1] = j2; GenericSequentialSolver solver(p_C1C2); return solver.jointFactorGraph(j12,function); +#else + std::vector indices(2); + indices[0] = j1; + indices[1] = j2; + GenericSequentialSolver solver(FactorGraph(*this)); + return solver.jointFactorGraph(indices, function); +#endif } /* ************************************************************************* */