Stan Math Library
5.0.0
Automatic Differentiation
|
void stan::math::hessian | ( | const F & | f, |
const Eigen::Matrix< T, Eigen::Dynamic, 1 > & | x, | ||
T & | fx, | ||
Eigen::Matrix< T, Eigen::Dynamic, 1 > & | grad, | ||
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & | H | ||
) |
Calculate the value, the gradient, and the Hessian, of the specified function at the specified argument in time O(N^3) time and O(N^2) space.
The advantage over the mixed definition, which is faster for Hessians, is that this version is itself differentiable.
The functor must implement
fvar<fvar<T> > operator()(const Eigen::Matrix<fvar<fvar<T> >, Eigen::Dynamic, 1>&)
using only operations that are defined for the argument type.
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.
T | type of elements in the vector and matrix |
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 41 of file hessian.hpp.