From 8c4e775bada33875fa37d41fee91d88d78832012 Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Tue, 26 Aug 2014 14:48:24 +0200 Subject: [PATCH] [Bug fix] Off-by-one in FPI counting --- src/fixedpointiterator.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fixedpointiterator.cc b/src/fixedpointiterator.cc index 5b7a394f..517db55b 100644 --- a/src/fixedpointiterator.cc +++ b/src/fixedpointiterator.cc @@ -41,7 +41,7 @@ int FixedPointIterator<Factory, StateUpdater, VelocityUpdater>::run( Vector previousVelocityIterate = velocityIterate; size_t fixedPointIteration; - for (fixedPointIteration = 1; fixedPointIteration <= fixedPointMaxIterations_; + for (fixedPointIteration = 0; fixedPointIteration < fixedPointMaxIterations_; ++fixedPointIteration) { Vector v_m; velocityUpdater->extractOldVelocity(v_m); @@ -63,8 +63,10 @@ int FixedPointIterator<Factory, StateUpdater, VelocityUpdater>::run( velocityProblemSolver.solve(); if (velocityMatrixNorm.diff(previousVelocityIterate, velocityIterate) < - fixedPointTolerance_) + fixedPointTolerance_) { + fixedPointIteration++; break; + } previousVelocityIterate = velocityIterate; } -- GitLab