Commit bcc18528 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Fixed bug in GMRES solver

The condition substituting nextIteration() is different than in the
method itself, because incrementing the iteration counter is avoided.
parent b6185357
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -251,7 +251,10 @@ bool tnlGMRESSolver< Matrix, Preconditioner > :: solve( const Vector& b, Vector&
                             sn[ i ] );

         this->setResidue( fabs( s[ i + 1 ] ) / normb );
         if( this->getIterations() > this->getMinIterations() && this->getResidue() < this->getConvergenceResidue() ) {
         // The nextIteration() method should not be called here, because it increments
         // the iteration counter. The condition below is slightly different than in
         // nextIteration(), because it first increments and then compares.
         if( this->getIterations() >= this->getMinIterations() && this->getResidue() < this->getConvergenceResidue() ) {
            update( i, m, _H, _s, _v, x );
            this->refreshSolverMonitor( true );
            return this->checkConvergence();
+1 −1
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ bool tnlIterativeSolver< Real, Index> :: nextIteration()

   if( std::isnan( this->getResidue() ) || 
       this->getIterations() > this->getMaxIterations()  ||
       ( this->getResidue() > this->getDivergenceResidue() && this->getIterations() > this->minIterations ) ||
       ( this->getResidue() > this->getDivergenceResidue() && this->getIterations() > this->getMinIterations() ) ||
       ( this->getResidue() < this->getConvergenceResidue() && this->getIterations() > this->minIterations ) ) 
      return false;
   return true;