trust_region.m: trap case where linear combination with weight 0 on infinite value returns NaN
parent
20f8dd780f
commit
c91e1f895b
|
@ -327,5 +327,9 @@ else
|
|||
end
|
||||
% Form the appropriate convex combination of the Gauss-Newton direction and the
|
||||
% scaled gradient direction.
|
||||
x = alpha*x + (1.0-alpha)*min(sgnorm, delta)*s;
|
||||
if alpha>0
|
||||
x = alpha*x + (1.0-alpha)*min(sgnorm, delta)*s;
|
||||
else %prevent zero weight on Inf evaluating to NaN
|
||||
x = min(sgnorm, delta)*s;
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue