NAG AD Library
x10ad_a1w_f (config_​mode_​get_a1w)

1 Purpose

x10ad_a1w_f gets the computational mode from a configuration data structure for the NAG AD Library as created by a prior call to x10aa_a1w_f and where the mode has been set using a prior call to x10ac_a1w_f. The full set of computational modes currently available are: nagad_algorithmic and nagad_symbolic. See mode. This routine must be called after a call to x10aa_a1w_f (to create a handle to the configuration data object).

2 Specification

Fortran Interface
Subroutine x10ad_a1w_f ( ad_handle, mode, ifail)
Integer, Intent (Inout) :: ifail
Integer, Intent (Out) :: mode
Type (c_ptr), Intent (In) :: ad_handle
C++ Header Interface
#include <nagad.h>
extern "C" {
void  x10ad_a1w_f_ (void *&ad_handle, Integer &mode, Integer &ifail)
}
The routine may be called by the names x10ad_a1w_f or nagf_adutils_config_mode_get_a1w.

3 Description

x10ad_a1w_f gets the computational mode of differentiation from the configuration data object as created by x10aa_a1w_f and where the computational mode has been set by a call to x10ac_a1w_f (see mode). This handle may then be passed to any computational routine in the NAG AD Library as listed in the Introduction to the NAG AD Library.

3.1 Life Cycle of the Handle

Each handle should pass four stages in its life: initialization; mode setting; problem solution using the NAG AD Library; and, destruction.
The initialization by x10aa_a1w_f and destruction by x10ab_a1w_f mark the beginning and the end of the life of the handle. During this time the handle must only be modified by NAG AD Library routines. Working with a handle which has not been properly initialized is potentially very dangerous as it may cause unpredictable behaviour.
After the handle has been initialized, two routines are provided to set or get the computational mode to be used in algorithmic differentiation. If, for example, a callback needs to know the computational mode in order to provide differentials appropriately, x10ad_a1w_f will return the current computational mode as stored in the ad_handle.
The handle is then passed to the computational routines of the NAG AD Library.
When all AD computation is completed, the handle must be destroyed by x10ab_a1w_f.

4 References

None.

5 Arguments

1: ad_handle Type (c_ptr) Input
On entry: contains a handle to the AD configuration data object in which the computational mode is defined.
2: mode Integer Output
On exit: the computational mode as stored in the AD configuration data object with handle ad_handle.
3: ifail Integer Input/Output
On entry: ifail must be set to 0, -1 or 1. If you are unfamiliar with this argument you should refer to Section 4 in the Introduction to the NAG Library FL Interface for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1 or 1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this argument, the recommended value is 0. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=1
On entry: ad_handle is not a valid handle for the AD computational data object. Either ad_handle has not been initialized or it has become corrupted.
ifail=2
Unexpected value of mode set on exit, mode=value.
Constraint: mode=nag_algorithmic or nag_symbolic.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
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.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

x10ad_a1w_f is not threaded in any implementation.

9 Further Comments

None.

10 Example

See examples for computational routines in the NAG AD Library, for example, Section 10 in c05ay_a1w_f.