Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ run_newton_loop()

template<typename SolverPolicy , typename NewtonStateT , typename OptionsT , typename LLFunT , typename LLTupleArgsT , typename CovarMatT , typename UpdateFun >
auto stan::math::internal::run_newton_loop ( SolverPolicy &  solver,
NewtonStateT &  state,
const OptionsT &  options,
Eigen::Index &  step_iter,
const LLFunT &  ll_fun,
const LLTupleArgsT &  ll_args,
const CovarMatT &  covariance,
UpdateFun &&  update_fun,
std::ostream *  msgs 
)
inline

Run a Newton loop with a solver policy, updating the shared state.

This helper centralizes the iteration/line-search logic shared across solver policies while preserving the step counter and fallback behavior.

Template Parameters
SolverPolicyEither Solver 1, 2, or 3 policy struct
NewtonStateTType holding state with solver
OptionsTstruct of options for laplace
LLFunTCallable accepting (ThetaVec, LLTupleArgs...)
LLTupleArgsTtuple of additional args for LLFunT
CovarMatTType of the covariance matrix
Parameters
[in,out]solverThe solver policy instance
[in,out]stateShared Newton optimization state
[in]optionsSolver options
[in,out]step_iterCurrent iteration number (modified)
[in]ll_funLog-likelihood functor
[in]ll_argsAdditional arguments for the likelihood
[in]covariancePrior covariance matrix Sigma
[in]update_funCallable to update proposal state in line search
[in,out]msgsOutput stream for diagnostic messages (may be nullptr)
Returns
laplace_density_estimates built from solver policy

Stop when objective change is small, or when a rejected Wolfe step fails to improve; finish_update then exits the Newton loop.

Definition at line 927 of file laplace_marginal_density_estimator.hpp.