diff --git a/gtsam.h b/gtsam.h index d19b0bf45..a3d8c478b 100644 --- a/gtsam.h +++ b/gtsam.h @@ -914,6 +914,7 @@ virtual class BayesTree { size_t size(); CLIQUE* root() const; void clear(); + void deleteCachedShorcuts(); void insert(const CLIQUE* subtree); }; @@ -944,10 +945,6 @@ virtual class BayesTreeClique { // FactorGraph marginal(derived_ptr root, Eliminate function) const; // FactorGraph joint(derived_ptr C2, derived_ptr root, Eliminate function) const; - /** - * This deletes the cached shortcuts of all cliques (subtree) below this clique. - * This is performed when the bayes tree is modified. - */ void deleteCachedShorcuts(); }; diff --git a/gtsam/inference/BayesTree.h b/gtsam/inference/BayesTree.h index 842815bdc..6406fe8f6 100644 --- a/gtsam/inference/BayesTree.h +++ b/gtsam/inference/BayesTree.h @@ -212,6 +212,9 @@ namespace gtsam { /** Remove all nodes */ void clear(); + /** Clear all shortcut caches - use before timing on marginal calculation to avoid residual cache data */ + inline void deleteCachedShorcuts() { root_->deleteCachedShorcuts(); } + /** * Remove path from clique to root and return that path as factors * plus a list of orphaned subtree roots. Used in removeTop below.