Stan Math Library
4.9.0
Automatic Differentiation
|
void stan::math::finite_diff_grad_hessian_auto | ( | const F & | f, |
const Eigen::VectorXd & | x, | ||
double & | fx, | ||
Eigen::MatrixXd & | hess, | ||
std::vector< Eigen::MatrixXd > & | grad_hess_fx | ||
) |
Calculate the value, Hessian, and the gradient of the Hessian of the specified function at the specified argument using second-order autodiff and first-order finite difference.
The functor must implement
double operator()(const Eigen::VectorXd&) const;
Reference for finite difference to compute gradient:
De Levie: An improved numerical approximation for the first derivative, page 3
Step size for dimension i
is set automatically using stan::math::finite_diff_stepsize(H(i, j))
; the nested finite differences are over entries in the Hessian.
Evaluating this function involves 6 calls to the Hessian autodiff function for each entry in the Hessian.
F | Type of function |
[in] | f | Function |
[in] | x | Argument to function |
[out] | fx | Function applied to argument |
[out] | hess | Hessian matrix |
[out] | grad_hess_fx | gradient of Hessian of function at argument |
Definition at line 44 of file finite_diff_grad_hessian_auto.hpp.