Stan Math Library
5.0.0
Automatic Differentiation
|
void stan::math::hessian | ( | const F & | f, |
const Eigen::Matrix< double, Eigen::Dynamic, 1 > & | x, | ||
double & | fx, | ||
Eigen::Matrix< double, Eigen::Dynamic, 1 > & | grad, | ||
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > & | H | ||
) |
Calculate the value, the gradient, and the Hessian, of the specified function at the specified argument in O(N^2) time and O(N^2) space.
The functor must implement
fvar<var> operator()(const Eigen::Matrix<fvar<var>, Eigen::Dynamic, 1>&)
using only operations that are defined for fvar
and var
.
This latter constraint usually requires the functions to be defined in terms of the libraries defined in Stan or in terms of functions with appropriately general namespace imports that eventually depend on functions defined in Stan.
F | Type of function |
[in] | f | Function |
[in] | x | Argument to function |
[out] | fx | Function applied to argument |
[out] | grad | gradient of function at argument |
[out] | H | Hessian of function at argument |
Definition at line 42 of file hessian.hpp.