Minor change to shortcut
parent
2d0ce1c3ca
commit
bfc033d3f7
|
@ -113,7 +113,7 @@ namespace gtsam {
|
|||
|
||||
static const bool debug = false;
|
||||
|
||||
BayesNet<ConditionalType> p_S_R; //shortcut P(S|R)
|
||||
BayesNet<ConditionalType> p_S_R; //shortcut P(S|R) This is empty now
|
||||
|
||||
//Check if the ShortCut already exists
|
||||
if(!cachedShortcut_){
|
||||
|
@ -122,11 +122,7 @@ namespace gtsam {
|
|||
// in which case we return an empty Bayes net.
|
||||
|
||||
derived_ptr parent(parent_.lock());
|
||||
|
||||
if (R.get() == this || parent == R) {
|
||||
BayesNet<ConditionalType> empty;
|
||||
return empty;
|
||||
}
|
||||
if (R.get() != this && parent != R) {
|
||||
|
||||
// The root conditional
|
||||
FactorGraph<FactorType> p_R(BayesNet<ConditionalType>(R->conditional()));
|
||||
|
@ -201,12 +197,14 @@ namespace gtsam {
|
|||
// Undo the permutation
|
||||
if(debug) toBack.print("toBack: ");
|
||||
p_S_R.permuteWithInverse(toBack);
|
||||
}
|
||||
|
||||
assertInvariants();
|
||||
cachedShortcut_ = p_S_R;
|
||||
}
|
||||
else
|
||||
p_S_R = *cachedShortcut_;
|
||||
p_S_R = *cachedShortcut_; // return the cached version
|
||||
|
||||
assertInvariants();
|
||||
|
||||
// return the shortcut P(S|R)
|
||||
return p_S_R;
|
||||
|
|
Loading…
Reference in New Issue