From 684af9824974f67e0b517834a1038f5c1ac5ed85 Mon Sep 17 00:00:00 2001 From: Alex Cunningham Date: Mon, 10 Sep 2012 20:07:59 +0000 Subject: [PATCH] Added function to manually clear shortcut caches in a bayes tree --- gtsam.h | 5 +---- gtsam/inference/BayesTree.h | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) 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.