![]() |
Stan Math Library
5.2.0
Automatic Differentiation
|
Holds the state for the Newton-Raphson optimization loop.
This struct centralizes all state needed during the Newton iteration, including the Wolfe line search state, workspace matrices, and convergence flags. It is shared across different solver policies to avoid re-allocation and to maintain progress (e.g., line search history) across solver fallbacks.
| ObjFun | Type of the objective function callable |
| ThetaGradFun | Type of the theta gradient function callable |
Definition at line 347 of file laplace_marginal_density_estimator.hpp.
#include <laplace_marginal_density_estimator.hpp>
Public Member Functions | |
| template<typename ObjFun , typename ThetaGradFun , typename ThetaInitializer > | |
| NewtonState (int theta_size, ObjFun &&obj_fun, ThetaGradFun &&theta_grad_f, ThetaInitializer &&theta_init) | |
| Constructs Newton state with given dimensions and functors. | |
| auto & | curr () & |
| Access the current step state (mutable). | |
| const auto & | curr () const & |
| Access the current step state (const). | |
| auto && | curr () && |
| auto & | prev () & |
| Access the previous step state (mutable). | |
| const auto & | prev () const & |
| Access the previous step state (const). | |
| auto && | prev () && |
| template<typename Options > | |
| void | update_next_step (const Options &options) |
Public Attributes | |
| WolfeInfo | wolfe_info |
| Wolfe line search state including current/previous steps. | |
| WolfeStatus | wolfe_status |
| Status of the most recent Wolfe line search. | |
| Eigen::VectorXd | b |
| Workspace vector: b = W * theta + grad(log_lik) | |
| Eigen::MatrixXd | B |
| Workspace matrix: B = I + W_r * Sigma * W_r (or similar) | |
| Eigen::VectorXd | prev_g |
| Previous gradient for Barzilai-Borwein step calculation. | |
| bool | final_loop = false |
| On the final loop if we found a better wolfe step, but we are going to exit, we want to make sure all of our return values are with the most recent wolfe step that was accepted. | |