Fixed bug in FactorGraph::eliminate - was not unpermuting the removed factors - even though they're removed, since they're shared, they can be used still in other graphs

release/4.3a0
Richard Roberts 2013-03-18 19:27:53 +00:00
parent 3a62daf985
commit d9ef381483
1 changed files with 3 additions and 2 deletions

View File

@ -184,8 +184,7 @@ namespace gtsam {
Permutation toFront = Permutation::PullToFront(variables, highestInvolvedVariable+1);
Permutation toFrontInverse = *toFront.inverse();
BOOST_FOREACH(const sharedFactor& factor, involvedFactors) {
factor->permuteWithInverse(toFrontInverse);
}
factor->permuteWithInverse(toFrontInverse); }
// Eliminate into conditional and remaining factor
EliminationResult eliminated = eliminateFcn(involvedFactors, variables.size());
@ -193,6 +192,8 @@ namespace gtsam {
remainingFactor = eliminated.second;
// Undo the permutation
BOOST_FOREACH(const sharedFactor& factor, involvedFactors) {
factor->permuteWithInverse(toFront); }
conditional->permuteWithInverse(toFront);
remainingFactor->permuteWithInverse(toFront);
} else {