Let me try to be more specific.
I can see that the
hessian function takes as arguments a
model and memory that has been pre-allocated to store the value of the log prob, the gradient, and the Hessian.
hessian(const M& model,
const Eigen::Matrix<double, Eigen::Dynamic, 1>& x,
Eigen::Matrix<double, Eigen::Dynamic, 1>& grad_f,
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>& hess_f,
std::ostream* msgs = 0)
I assume that the
model object that is passed in here has had its parameter values set at some point, since of course the Hessian is evaluated at some particular set of parameter values and they do not appear here. My question is how to set them. That is, suppose I give you a
model object, a
params_r vector, and a
params_i vector. Howe to I get a version of the
model that I can pass into the
hessian function so I get the hessian at those parameter values?
Note that, unlike the
par_i as arguments. I have looked at how they are used inside
log_prob_grad. They are passed as arguments to the construction of a
var type which is then differentiated.
= model.template log_prob<propto, jacobian_adjust_transform>
(ad_params_r, params_i, msgs);
But I don't see how to use this to produce something I could pass to the
Does this make sense?