Routines for minimizing a function
$F\left({x}_{1},{x}_{2},\dots ,{x}_{n}\right)$ of the variables
${x}_{1},{x}_{2},\dots ,{x}_{n}$ may require you to provide a subroutine to evaluate the second derivatives of
$F$.
e04hdf is designed to check the second derivatives calculated by such user-supplied subroutines. As well as the routine to be checked (
h), you must supply a subroutine (
funct) to evaluate the first derivatives, and a point
$x={\left({x}_{1},{x}_{2},\dots ,{x}_{n}\right)}^{\mathrm{T}}$ at which the checks will be made. Note that
e04hdf checks routines of the form required for
e04lbf.
e04hdf first calls user-supplied subroutines
funct and
h to evaluate the first and second derivatives of
$F$ at
$x$. The user-supplied Hessian matrix (
$H$, say) is projected onto two orthogonal vectors
$y$ and
$z$ to give the scalars
${y}^{\mathrm{T}}Hy$ and
${z}^{\mathrm{T}}Hz$ respectively. The same projections of the Hessian matrix are also estimated by finite differences, giving
respectively, where
$g\left(\right)$ denotes the vector of first derivatives at the point in brackets and
$h$ is a small positive scalar. If the relative difference between
$p$ and
${y}^{\mathrm{T}}Hy$ or between
$q$ and
${z}^{\mathrm{T}}Hz$ is judged too large, an error indicator is set.
None.
If on entry
${\mathbf{ifail}}=0$ or
$-1$, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
ifail is set to
$2$ if
where
$h$ is set equal to
$\sqrt{\epsilon}$ (
$\epsilon $ being the
machine precision as given by
x02ajf) and other quantities are as defined in
Section 3.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
Suppose that it is intended to use
e04lbf to minimize
The following program could be used to check the second derivatives calculated by
h required. (The call of
e04hdf is preceded by a call of
e04hcf to check
funct which calculates the first derivatives.)
None.