NAG AD Library Routine Document

e04fc_a1w_f (lsq_uncon_mod_func_comp_a1w)


Note: _a1w_ denotes that first order adjoints are computed in working precision; this has the corresponding argument type nagad_a1w_w_rtype. Further implementations, for example for higher order differentiation or using the tangent linear approach, may become available at later marks of the NAG AD Library. The method of codifying AD implementations in routine name and corresponding argument types is described in the NAG AD Library Introduction.

1
Purpose

e04fc_a1w_f is the adjoint version of the primal routine e04fcf .

2
Specification

Fortran Interface
Subroutine e04fc_a1w_f (ad_handle, m, n, lsqfun, lsqmon, iprint, maxcal, eta, xtol, stepmx, x, fsumsq, fvec, fjac, ldfjac, s, v, ldv, niter, nf, iuser, ruser, ifail)
Integer, Intent (In):: m, n, iprint, maxcal, ldfjac, ldv
Integer, Intent (Inout):: iuser(*), ifail
Integer, Intent (Out):: niter, nf
Type (nagad_a1w_w_rtype), Intent (In):: eta, xtol, stepmx
Type (nagad_a1w_w_rtype), Intent (Inout):: x(n), fjac(ldfjac,n), v(ldv,n), ruser(*)
Type (nagad_a1w_w_rtype), Intent (Out):: fsumsq, fvec(m), s(n)
Type (c_ptr), Intent (In):: ad_handle
External:: lsqfun, lsqmon
Subroutine lsqfun (ad_handle, iflag, m, n, xc, fvec, iuser, ruser)
Integer, Intent (In):: m, n
Integer, Intent (Inout):: iflag, iuser(*)
Type (nagad_a1w_w_rtype), Intent (Inout):: xc(n), ruser(*), fvec(m)
Type (c_ptr), Intent (In):: ad_handle
Subroutine lsqmon (ad_handle, m, n, xc, fvec, fjac, ldfjac, s, igrade, niter, nf, iuser, ruser)
Integer, Intent (In):: m, n, ldfjac, igrade, niter, nf
Integer, Intent (Inout):: iuser(*)
Type (nagad_a1w_w_rtype), Intent (Inout):: xc(n), fvec(m), fjac(ldfjac,n), s(n), ruser(*)
Type (c_ptr), Intent (In):: ad_handle
C++ Header Interface
#include <nagad.h>
void e04fc_a1w_f_ (void *&ad_handle, const Integer &m, const Integer &n,
void (NAG_CALL lsqfun)(void *&ad_handle, Integer &iflag, const Integer &m, const Integer &n, nagad_a1w_w_rtype xc[], nagad_a1w_w_rtype fvec[], Integer iuser[], nagad_a1w_w_rtype ruser[]),
void (NAG_CALL lsqmon)(void *&ad_handle, const Integer &m, const Integer &n, nagad_a1w_w_rtype xc[], nagad_a1w_w_rtype fvec[], nagad_a1w_w_rtype fjac[], const Integer &ldfjac, nagad_a1w_w_rtype s[], const Integer &igrade, const Integer &niter, const Integer &nf, Integer iuser[], nagad_a1w_w_rtype ruser[]),
const Integer &iprint, const Integer &maxcal, const nagad_a1w_w_rtype &eta, const nagad_a1w_w_rtype &xtol, const nagad_a1w_w_rtype &stepmx, nagad_a1w_w_rtype x[], nagad_a1w_w_rtype &fsumsq, nagad_a1w_w_rtype fvec[], nagad_a1w_w_rtype fjac[], const Integer &ldfjac, nagad_a1w_w_rtype s[], nagad_a1w_w_rtype v[], const Integer &ldv, Integer &niter, Integer &nf, Integer iuser[], nagad_a1w_w_rtype ruser[], Integer &ifail)

3
Description

e04fcf is a comprehensive algorithm for finding an unconstrained minimum of a sum of squares of m nonlinear functions in n variables mn. No derivatives are required.
The routine is intended for functions which have continuous first and second derivatives (although it will usually work even if the derivatives have occasional discontinuities). For further information see Section 3 in the documentation for e04fcf .

4
References

None.

5
Arguments

e04fc_a1w_f provides access to all the arguments available in the primal routine. There are also additional arguments specific to AD. A tooltip popup for each argument can be found by hovering over the argument name in Section 2 and a summary of the arguments are provided below:

6
Error Indicators and Warnings

e04fc_a1w_f preserves all error codes from e04fcf and in addition can return:
ifail=-89
An unexpected AD error has been triggered by this routine. Please contact NAG.
See Section 5.2 in the NAG AD Library Introduction for further information.
ifail=-899
Dynamic memory allocation failed for AD.
See Section 5.1 in the NAG AD Library Introduction for further information.

7
Accuracy

Not applicable.

8
Parallelism and Performance

e04fc_a1w_f is not threaded in any implementation.

9
Further Comments

None.

10
Example

The following examples are variants of the example for e04fcf , modified to demonstrate calling the NAG AD Library.
LanguageSource FileDataResults
Fortane04fc_a1w_fe.f90e04fc_a1w_fe.de04fc_a1w_fe.r
C++e04fc_a1w_hcppe.cppe04fc_a1w_hcppe.de04fc_a1w_hcppe.r