From 134951f21cf6617acbcaf9f49f33a79c6ff56b6d Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Thu, 5 Jul 2012 18:59:10 +0000 Subject: [PATCH] In iSAM2, added a check in the Batch-mode path that checks if linearized factors should be stored for performance reasons. Without this, factors were cached in batch-mode but not in the normal incremental-mode, leading to inconsistency --- gtsam/nonlinear/ISAM2.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gtsam/nonlinear/ISAM2.cpp b/gtsam/nonlinear/ISAM2.cpp index 7fb23884b..779880dab 100644 --- a/gtsam/nonlinear/ISAM2.cpp +++ b/gtsam/nonlinear/ISAM2.cpp @@ -329,11 +329,13 @@ boost::shared_ptr > ISAM2::recalculate( toc(1,"reorder"); tic(2,"linearize"); - linearFactors_ = *nonlinearFactors_.linearize(theta_, ordering_); + GaussianFactorGraph linearized = *nonlinearFactors_.linearize(theta_, ordering_); + if(params_.cacheLinearizedFactors) + linearFactors_ = linearized; toc(2,"linearize"); tic(5,"eliminate"); - JunctionTree jt(linearFactors_, variableIndex_); + JunctionTree jt(linearized, variableIndex_); sharedClique newRoot; if(params_.factorization == ISAM2Params::CHOLESKY) newRoot = jt.eliminate(EliminatePreferCholesky); @@ -352,7 +354,7 @@ boost::shared_ptr > ISAM2::recalculate( lastAffectedMarkedCount = markedKeys.size(); lastAffectedVariableCount = affectedKeysSet->size(); - lastAffectedFactorCount = linearFactors_.size(); + lastAffectedFactorCount = linearized.size(); // Reeliminated keys for detailed results if(params_.enableDetailedResults) {