Skip to content

Commit

Permalink
fixed a corner case when ||g(x_0)|| is exactly zero
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhepeiWang committed Nov 24, 2022
1 parent dc0e4cb commit a96c50e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/lbfgs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ namespace lbfgs
gnorm_inf = g.cwiseAbs().maxCoeff();
xnorm_inf = x.cwiseAbs().maxCoeff();

if (gnorm_inf / std::max(1.0, xnorm_inf) < param.g_epsilon)
if (gnorm_inf / std::max(1.0, xnorm_inf) <= param.g_epsilon)
{
/* The initial guess is already a stationary point. */
ret = LBFGS_CONVERGENCE;
Expand All @@ -554,7 +554,7 @@ namespace lbfgs
xp = x;
gp = g;

/* If the step bound can be provied dynamically, then apply it. */
/* If the step bound can be provided dynamically, then apply it. */
step_min = param.min_step;
step_max = param.max_step;
if (cd.proc_stepbound)
Expand Down

0 comments on commit a96c50e

Please sign in to comment.