The user's program may access the derivatives which GQOPT uses. If analytic derivatives are not supplied by the user, numerical derivatives will be loaded. Clearly, the user may call his own derivative routines directly, as he knows the parameters which are needed. To facilitate reference to either analytic or numerical derivatives, SUBROUTINE DERIV has been created, which does the special initialization required for numerical derivatives:



X0 = The variable value at which derivatives are to be found
NP = The number of variables
FU0 = The function value at X0
IDEVAL = 0, if FU0 is unknown. Upon return FU0 will be correct.
IDEVAL = 1, if FU0 contains the function value
FPD = The first partial derivatives (an array of length NP)
ID1 = 0, if ID1 should be reset by DERIV to the value to ID2
ID1 = 1, if symmetric first derivatives are desired
ID1 = 2, if simple first derivatives are desired
SPD = The second partial derivatives (an array NP by NP)
ID2 = 0, if SPD should not be found
ID2 = 1, if symmetric second derivatives are desired
ID2 = 2, if simple second derivatives are desired
FUNC = The function to be evaluated
*nnn = An error return point.

Note: This routine changes IFP and ISP, from COMMON/BOPT/ . These values should be rechecked before calling OPT. It may be necessary to reinitialize by calling DFLT, in which case OPT must be linked along with anything else that may be needed. DERIV must also not be called between a call to OPT and a call to OPTOUT or OPTMOV, as values in some matrices may be changed. If second partial derivatives are requested (ID2 is not zero), then first partials must also be found; if ID1 is zero it will be reset to the value of ID2. The main program must include COMMON/BSTACK/ with at least NP*NP words of storage. DERIV may be called by a user's program even if no call is made to OPT.

Return to the Beginning