Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/unconstrained/cg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ optim::internal::cg_impl(

//

double t_init = 1.0; // initial value for line search
double t_init = 1.0 / grad_err; // initial value for line search

d = - grad;
Vec_t x_p = x, grad_p = grad;
Expand All @@ -138,7 +138,7 @@ optim::internal::cg_impl(
grad_err = OPTIM_MATOPS_L2NORM(grad_p);
double rel_sol_change = OPTIM_MATOPS_L1NORM( OPTIM_MATOPS_ARRAY_DIV_ARRAY( (x_p - x), (OPTIM_MATOPS_ARRAY_ADD_SCALAR(OPTIM_MATOPS_ABS(x), 1.0e-08)) ) );

OPTIM_CG_TRACE(0, grad_err, rel_sol_change, x, d, grad, 0.0);
OPTIM_CG_TRACE(0, grad_err, rel_sol_change, x_p, d, grad_p, 0.0);

if (grad_err <= grad_err_tol) {
init_out_vals = x_p;
Expand All @@ -162,7 +162,7 @@ optim::internal::cg_impl(

grad = grad_p;

t = line_search_mt(t_init, x_p, grad_p, d, &wolfe_cons_1, &wolfe_cons_2, box_objfn, opt_data);
t = line_search_mt(t_init, x_p, grad_p, d_p, &wolfe_cons_1, &wolfe_cons_2, box_objfn, opt_data);

//

Expand Down