Fix for infinite loop on 32-bit Linux.

release/4.3a0
Chris Beall 2014-05-14 19:14:38 -04:00
parent e1c0ad8335
commit d0a2db6646
1 changed files with 1 additions and 1 deletions

View File

@ -191,7 +191,7 @@ typename DoglegOptimizerImpl::IterationResult DoglegOptimizerImpl::Iterate(
if(mode == ONE_STEP_PER_ITERATION || mode == SEARCH_REDUCE_ONLY)
stay = false; // If not searching, just return with the new Delta
else if(mode == SEARCH_EACH_ITERATION) {
if(newDelta == Delta || lastAction == DECREASED_DELTA)
if(fabs(newDelta - Delta) < 1e-15 || lastAction == DECREASED_DELTA)
stay = false; // Searching, but Newton's solution is within trust region so keep the same trust region
else {
stay = true; // Searching and increased Delta, so try again to increase Delta