diff --git a/src/unconstrained/cg.cpp b/src/unconstrained/cg.cpp index 151117c..508d95e 100644 --- a/src/unconstrained/cg.cpp +++ b/src/unconstrained/cg.cpp @@ -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; @@ -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; @@ -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); //