Minor updates: cachedShortcut is now protected. DeleteCachedShortcuts() are now called on the resulting orphans in the removeTop() instead of the whole tree.
parent
6f1ea87a00
commit
e42dc5cdc9
|
|
@ -575,9 +575,6 @@ namespace gtsam {
|
||||||
void BayesTree<CONDITIONAL,CLIQUE>::removeTop(const CONTAINER& keys,
|
void BayesTree<CONDITIONAL,CLIQUE>::removeTop(const CONTAINER& keys,
|
||||||
BayesNet<CONDITIONAL>& bn, typename BayesTree<CONDITIONAL,CLIQUE>::Cliques& orphans) {
|
BayesNet<CONDITIONAL>& bn, typename BayesTree<CONDITIONAL,CLIQUE>::Cliques& orphans) {
|
||||||
|
|
||||||
//TODO: Improve this
|
|
||||||
deleteCachedShorcuts(this->root_);
|
|
||||||
|
|
||||||
// process each key of the new factor
|
// process each key of the new factor
|
||||||
BOOST_FOREACH(const Index& key, keys) {
|
BOOST_FOREACH(const Index& key, keys) {
|
||||||
|
|
||||||
|
|
@ -590,6 +587,11 @@ namespace gtsam {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete cachedShorcuts for each orphan subtree
|
||||||
|
//TODO: Consider Improving
|
||||||
|
BOOST_FOREACH(sharedClique& orphan, orphans)
|
||||||
|
deleteCachedShorcuts(orphan);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
|
||||||
|
|
@ -75,14 +75,14 @@ namespace gtsam {
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
/// This stores the Cached Shortcut value
|
||||||
|
mutable boost::optional<BayesNet<ConditionalType> > cachedShortcut_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
sharedConditional conditional_;
|
sharedConditional conditional_;
|
||||||
derived_weak_ptr parent_;
|
derived_weak_ptr parent_;
|
||||||
std::list<derived_ptr> children_;
|
std::list<derived_ptr> children_;
|
||||||
|
|
||||||
/// This stores the Cached Shortcut value
|
|
||||||
mutable boost::optional<BayesNet<ConditionalType> > cachedShortcut_;
|
|
||||||
|
|
||||||
/// @name Testable
|
/// @name Testable
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
@ -114,7 +114,7 @@ namespace gtsam {
|
||||||
/** The arrow operator accesses the conditional */
|
/** The arrow operator accesses the conditional */
|
||||||
const ConditionalType* operator->() const { return conditional_.get(); }
|
const ConditionalType* operator->() const { return conditional_.get(); }
|
||||||
|
|
||||||
///TODO: comment
|
/** return the const reference of children */
|
||||||
const std::list<derived_ptr>& children() const { return children_; }
|
const std::list<derived_ptr>& children() const { return children_; }
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
@ -124,7 +124,7 @@ namespace gtsam {
|
||||||
/** The arrow operator accesses the conditional */
|
/** The arrow operator accesses the conditional */
|
||||||
ConditionalType* operator->() { return conditional_.get(); }
|
ConditionalType* operator->() { return conditional_.get(); }
|
||||||
|
|
||||||
/** return the const reference of children */
|
/** return the reference of children non-const version*/
|
||||||
std::list<derived_ptr>& children() { return children_; }
|
std::list<derived_ptr>& children() { return children_; }
|
||||||
|
|
||||||
/** Construct shared_ptr from a conditional, leaving parent and child pointers uninitialized */
|
/** Construct shared_ptr from a conditional, leaving parent and child pointers uninitialized */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue