@@ -394,8 +394,7 @@ struct NewtonState {
394394 */
395395 template <typename ObjFun, typename ThetaGradFun, typename ThetaInitializer>
396396 NewtonState (int theta_size, ObjFun&& obj_fun, ThetaGradFun&& theta_grad_f,
397- const Eigen::VectorXd& a_init,
398- ThetaInitializer&& theta_init)
397+ const Eigen::VectorXd& a_init, ThetaInitializer&& theta_init)
399398 : wolfe_info(std::forward<ObjFun>(obj_fun), a_init,
400399 std::forward<ThetaInitializer>(theta_init),
401400 std::forward<ThetaGradFun>(theta_grad_f), 0),
@@ -1018,9 +1017,7 @@ inline auto run_newton_loop(SolverPolicy& solver, NewtonStateT& state,
10181017 double obj_change = std::abs (state.curr ().obj () - state.prev ().obj ());
10191018 bool objective_converged
10201019 = obj_change < options.tolerance
1021- && obj_change
1022- < options.tolerance
1023- * std::abs (state.prev ().obj ());
1020+ && obj_change < options.tolerance * std::abs (state.prev ().obj ());
10241021 finish_update = objective_converged || search_failed;
10251022 }
10261023 if (finish_update) {
@@ -1218,13 +1215,11 @@ inline auto laplace_marginal_density_est(
12181215 // first Newton step.
12191216 auto make_state = [&](auto && theta_0) {
12201217 if constexpr (InitTheta) {
1221- Eigen::VectorXd a_init = covariance.llt ().solve (
1222- Eigen::VectorXd (theta_0));
1223- return internal::NewtonState (theta_size, obj_fun, theta_grad_f,
1224- a_init, theta_0);
1225- } else {
1226- return internal::NewtonState (theta_size, obj_fun, theta_grad_f,
1218+ Eigen::VectorXd a_init = covariance.llt ().solve (Eigen::VectorXd (theta_0));
1219+ return internal::NewtonState (theta_size, obj_fun, theta_grad_f, a_init,
12271220 theta_0);
1221+ } else {
1222+ return internal::NewtonState (theta_size, obj_fun, theta_grad_f, theta_0);
12281223 }
12291224 };
12301225 auto state = make_state (theta_init);
0 commit comments