NAG AD Library Routine Document

d01rg_a1w_f (dim1_fin_gonnet_vec_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

d01rg_a1w_f is the adjoint version of the primal routine d01rgf .

2
Specification

Fortran Interface
Subroutine d01rg_a1w_f (ad_handle, a, b, f, epsabs, epsrel, dinest, errest, nevals, iuser, ruser, ifail)
Integer, Intent (Inout):: iuser(*), ifail
Integer, Intent (Out):: nevals
Type (nagad_a1w_w_rtype), Intent (In):: a, b, epsabs, epsrel
Type (nagad_a1w_w_rtype), Intent (Inout):: ruser(*)
Type (nagad_a1w_w_rtype), Intent (Out):: dinest, errest
Type (c_ptr), Intent (In):: ad_handle
External:: f
Subroutine f (ad_handle, x, nx, fv, iflag, iuser, ruser)
Integer, Intent (In):: nx
Integer, Intent (Inout):: iflag, iuser(*)
Type (nagad_a1w_w_rtype), Intent (Inout):: x(nx), ruser(*), fv(nx)
Type (c_ptr), Intent (In):: ad_handle
C++ Header Interface
#include <nagad.h>
void d01rg_a1w_f_ (void *&ad_handle, const nagad_a1w_w_rtype &a, const nagad_a1w_w_rtype &b,
void (NAG_CALL f)(void *&ad_handle, nagad_a1w_w_rtype x[], const Integer &nx, nagad_a1w_w_rtype fv[], Integer &iflag, Integer iuser[], nagad_a1w_w_rtype ruser[]),
const nagad_a1w_w_rtype &epsabs, const nagad_a1w_w_rtype &epsrel, nagad_a1w_w_rtype &dinest, nagad_a1w_w_rtype &errest, Integer &nevals, Integer iuser[], nagad_a1w_w_rtype ruser[], Integer &ifail)

3
Description

d01rgf is a general purpose integrator which calculates an approximation to the integral of a function fx over a finite interval a,b:
I= ab fx dx .  
The routine is suitable as a general purpose integrator, and can be used when the integrand has singularities and infinities. In particular, the routine can continue if the subroutine f explicitly returns a quiet or signalling NaN or a signed infinity. For further information see Section 3 in the documentation for d01rgf .

4
References

None.

5
Arguments

d01rg_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

d01rg_a1w_f preserves all error codes from d01rgf 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

d01rg_a1w_f is not threaded in any implementation.

9
Further Comments

None.

10
Example

The following examples are variants of the example for d01rgf , modified to demonstrate calling the NAG AD Library.
LanguageSource FileDataResults
Fortand01rg_a1w_fe.f90d01rg_a1w_fe.dd01rg_a1w_fe.r
C++d01rg_a1w_hcppe.cppd01rg_a1w_hcppe.dd01rg_a1w_hcppe.r