Merge pull request #1068 from JohannesPfeifer/trust_region

Test for solution before breaking with error code -3 in trust_region
time-shift
MichelJuillard 2015-10-06 14:17:25 +02:00
commit f4e8fc74da
1 changed files with 10 additions and 3 deletions

View File

@ -146,7 +146,11 @@ while (niter < maxiter && ~info)
delta = 0.5*delta;
if (delta <= 1e1*macheps*xn)
% Trust region became uselessly small.
info = -3;
if (fn1 <= tolf)
info = 1;
else
info = -3;
end
break;
end
elseif (abs (1-ratio) <= 0.1)
@ -179,8 +183,11 @@ while (niter < maxiter && ~info)
info = 1;
end
end
check = ~info;
if info==1
check = 0;
else
check = 1;
end
end