hessutils.RdFast multiplication of Hessian and vector where computation of the full Hessian is not needed. Or determine the diagonal of the Hessian when non-diagonal entries are not needed or are nearly zero.
hessvec(f, x, v, csd = FALSE, ...)
hessdiag(f, x, ...)hessvec computes the product of a Hessian of a function
times a vector without deriving the full Hessian by approximating
the gradient (see the reference). If the function allows for the
complex-step method, the gradient can be calculated much more
accurate (see grad_csd).
hessdiag computes only the diagonal of the Hessian by
applying the central difference formula of second order to
approximate the partial derivatives.
hessvec returns the product H(f,x) * v as a vector.
hessdiag returns the diagonal of the Hessian of f.
B.A. Pearlmutter, Fast Exact Multiplication by the Hessian, Neural Computation (1994), Vol. 6, Issue 1, pp. 147-160.