E04HDF checks that a subroutine for calculating second derivatives of an objective function is consistent with a subroutine for calculating the corresponding first derivatives.
SUBROUTINE E04HDF ( |
N, FUNCT, H, X, G, HESL, LH, HESD, IW, LIW, W, LW, IFAIL) |
INTEGER |
N, LH, IW(LIW), LIW, LW, IFAIL |
REAL (KIND=nag_wp) |
X(N), G(N), HESL(LH), HESD(N), W(LW) |
EXTERNAL |
FUNCT, H |
|
Routines for minimizing a function
of the variables
may require you to provide a subroutine to evaluate the second derivatives of
. 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
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
at
. The user-supplied Hessian matrix (
, say) is projected onto two orthogonal vectors
and
to give the scalars
and
respectively. The same projections of the Hessian matrix are also estimated by finite differences, giving
respectively, where
denotes the vector of first derivatives at the point in brackets and
is a small positive scalar. If the relative difference between
and
or between
and
is judged too large, an error indicator is set.
None.
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
IFAIL is set to
if
where
is set equal to
(
being the
machine precision as given by
X02AJF) and other quantities are as defined in
Section 3.
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.