Test for solution before breaking with error code -3 in trust_region.m

Fixes #1067
time-shift
Johannes Pfeifer 2015-10-06 11:09:41 +02:00
parent 07e29125a2
commit 934901036b
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