Skip to content

Commit 21f0b68

Browse files
authored
Merge pull request #2318 from travisdriver/add/marginals-delete-cache
Added BayesTree cache clearing for Marginals
2 parents fec5580 + 495ca8b commit 21f0b68

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

gtsam/nonlinear/Marginals.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ VectorValues Marginals::optimize() const {
193193
return bayesTree_.optimize();
194194
}
195195

196+
/* ************************************************************************* */
197+
void Marginals::deleteCachedShortcuts() {
198+
bayesTree_.deleteCachedShortcuts();
199+
}
200+
196201
/* ************************************************************************* */
197202
void JointMarginal::print(const std::string& s, const KeyFormatter& formatter) const {
198203
cout << s << "Joint marginal on keys ";

gtsam/nonlinear/Marginals.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ class GTSAM_EXPORT Marginals {
119119
/** Compute the joint marginal information of several variables */
120120
JointMarginal jointMarginalInformation(const KeyVector& variables) const;
121121

122+
/** Delete cached Bayes tree shortcuts created while computing marginals */
123+
void deleteCachedShortcuts();
124+
122125
/** Optimize the bayes tree */
123126
VectorValues optimize() const;
124127

gtsam/nonlinear/nonlinear.i

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ class Marginals {
169169
const gtsam::KeyVector& variables) const;
170170
gtsam::JointMarginal jointMarginalInformation(
171171
const gtsam::KeyVector& variables) const;
172+
void deleteCachedShortcuts();
172173
};
173174

174175
class JointMarginal {

0 commit comments

Comments
 (0)