diff --git a/lib/lbfgs.c b/lib/lbfgs.c index 21f81b1..e11d316 100644 --- a/lib/lbfgs.c +++ b/lib/lbfgs.c @@ -643,7 +643,7 @@ static int line_search_backtracking_owlqn( /* Choose the orthant for the new point. */ for (i = 0;i < n;++i) { - wp[i] = (xp[i] == 0.) ? -gp[i] : wp[i]; + wp[i] = (xp[i] == 0.) ? -gp[i] : xp[i]; } for (;;) { @@ -823,9 +823,6 @@ static int line_search_morethuente( width = param->max_step - param->min_step; prev_width = 2.0 * width; - /* Copy the value of x to the work area. */ - veccpy(wa, x, n); - /* The variables stx, fx, dgx contain the values of the step, function, and directional derivative at the best step. @@ -868,7 +865,7 @@ static int line_search_morethuente( Compute the current value of x: x <- x + (*stp) * s. */ - veccpy(x, wa, n); + veccpy(x, xp, n); vecadd(x, s, *stp, n); /* Evaluate the function and gradient values. */ @@ -1264,6 +1261,9 @@ static int update_trial_interval( } + + + static lbfgsfloatval_t owlqn_x1norm( const lbfgsfloatval_t* x, const int start,