The routine may be called by the names c05zdf or nagf_roots_sys_deriv_check.
c05zdf is based on the MINPACK routine CHKDER (see Moré et al. (1980)). It checks the th gradient for consistency with the th function by computing a forward-difference approximation along a suitably chosen direction and comparing this approximation with the user-supplied gradient along the same direction. The principal characteristic of c05zdf is its invariance under changes in scale of the variables or functions.
Moré J J, Garbow B S and Hillstrom K E (1980) User guide for MINPACK-1 Technical Report ANL-80-74 Argonne National Laboratory
1: – IntegerInput
On entry: the value on the first call and the value on the second call of c05zdf.
On entry: the components of a point , at which the consistency check is to be made. (See Section 7.)
5: – Real (Kind=nag_wp) arrayInput
On entry: if , fvec must contain the value of the functions evaluated at . If , fvec is not referenced.
6: – Real (Kind=nag_wp) arrayInput
On entry: if , fjac must contain the value of
at the point , for and . If , fjac is not referenced.
7: – Real (Kind=nag_wp) arrayOutput
On exit: if , xp is set to a point neighbouring x. If , xp is undefined.
8: – Real (Kind=nag_wp) arrayInput
On entry: if , fvecp must contain the value of the functions evaluated at xp (as output by a preceding call to c05zdf with ). If , fvecp is not referenced.
9: – Real (Kind=nag_wp) arrayOutput
On exit: if , err contains measures of correctness of the respective gradients. If , err is undefined. If there is no loss of significance (see Section 7), if is the th user-supplied gradient
, for is correct, whilst if is the th gradient is incorrect. For values of between and the categorisation is less certain. In general, a value of indicates that the th gradient is probably correct.
10: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, .
Constraint: or .
On entry, .
On entry, .
An unexpected error has been triggered by this routine. Please
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
c05zdf does not perform reliably if cancellation or rounding errors cause a severe loss of significance in the evaluation of a function. Therefore, none of the components of should be unusually small (in particular, zero) or any other value which may cause loss of significance. The relative differences between corresponding elements of fvecp and fvec should be at least two orders of magnitude greater than the machine precision returned by x02ajf.
8Parallelism and Performance
c05zdf is not threaded in any implementation.
The time required by c05zdf increases with m and n.
This example checks the Jacobian matrix for a problem with functions of variables (sometimes referred to as the Bard problem).