Skip to content
Snippets Groups Projects
Verified Commit 10ceb6aa authored by Johannes Pfeifer's avatar Johannes Pfeifer Committed by Sébastien Villemot
Browse files

trust_region.m: trap case where linear combination with weight 0 on infinite value returns NaN

(manually cherry picked from commit c91e1f89)
parent 3329381e
No related merge requests found
......@@ -220,7 +220,11 @@ if (xn > delta)
snm = 0;
end
% Form the appropriate convex combination.
x = alpha * x + ((1-alpha) * min (snm, delta)) * s;
if alpha>0
x = alpha * x + ((1-alpha) * min (snm, delta)) * s;
else %prevent zero weight on Inf evaluating to NaN
x = min(snm, delta)*s;
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment