Stan Math Library
4.9.0
Automatic Differentiation
|
void stan::math::finite_diff_grad_hessian | ( | const F & | f, |
const Eigen::VectorXd & | x, | ||
double & | fx, | ||
Eigen::MatrixXd & | hess, | ||
std::vector< Eigen::MatrixXd > & | grad_hess_fx, | ||
double | epsilon = 1e-04 |
||
) |
Calculate the value 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::Matrix<double, Eigen::Dynamic, 1>&)
Reference:
De Levie: An improved numerical approximation for the first derivative, page 3
4 calls to the function, f.
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 |
[in] | epsilon | perturbation size |
Definition at line 41 of file finite_diff_grad_hessian.hpp.