trust_region/dogleg: fixing sign error

time-shift
Michel Juillard 2014-05-07 13:34:19 +02:00
parent c3544553ab
commit 58ba964bb7
1 changed files with 2 additions and 1 deletions

View File

@ -181,6 +181,7 @@ while (niter < maxiter && ~info)
% FIXME -- why tolf*n*xn? If abs (e) ~ abs(x) * eps is a vector
% of perturbations of x, then norm (fjac*e) <= eps*n*xn, i.e. by
% tolf ~ eps we demand as much accuracy as we can expect.
disp([niter fn ratio])
if (fn <= tolf*n*xn)
info = 1;
% The following tests done only after successful step.
@ -228,7 +229,7 @@ if (xn > delta)
bn = norm (b);
dxn = delta/xn; snmd = snm/delta;
t = (bn/sn) * (bn/xn) * snmd;
t = t - dxn * snmd^2 - sqrt ((t-dxn)^2 + (1-dxn^2)*(1-snmd^2));
t = t - dxn * snmd^2 + sqrt ((t-dxn)^2 + (1-dxn^2)*(1-snmd^2));
alpha = dxn*(1-snmd^2) / t;
else
alpha = 0;