Creates a tape of the Hessian of a function taped by CppAD.
The taped function represented by pfun must be scalar-valued (i.e. a vector of length 1).
The x vector and dynparam are used as the values to conduct the taping.
tape_Hessian(pfun)An Rcpp_ADFun object.
An Rcpp_ADFun object.
When the returned tape is evaluated (via say eval()), the resultant vector contains the Hessian in long format (see https://cppad.readthedocs.io/latest/Hessian.html):
suppose the function represented by pfun maps from \(n\)-dimensional space to \(1\)-dimensional space, then
the first \(n\) elements of the vector is the gradient of the partial derivative with respect to the first dimension of the function's domain;
the next \(n\) elements of the vector is the gradient of the partial derivative of the second dimension of the function's domain.
The Hessian as a matrix, can be obtained by using as.matrix() with ncol = n.
For creating this tape, the values of pfun$xtape and pfun$dyntape are used.
Other tape builders:
avgrange(),
fixdynamic(),
fixindependent(),
keeprange(),
tape_Jacobian(),
tape_bdryw(),
tape_gradoffset(),
tape_logJacdet(),
tape_smd(),
tape_swap(),
tape_uld()