Settings help

## 1Purpose

x10aa_AD_f initializes a configuration data structure for the NAG AD Library. It must be called prior to the first call to any routine from the NAG AD Library as listed in the Introduction to the NAG AD Library including any other routine in Chapter X10.

## 2Specification

Fortran Interface
 Integer, Intent (Inout) :: ifail Type (c_ptr), Intent (Out) :: ad_handle
To be consistent with the naming scheme for other routines in the AD Library, five routines are available with names formed by replacing AD in the above by one of p0w, a1w, t1w, a1t1w or t2w.
namespace nag {
 void x10aa (void *&ad_handle, Integer &ifail)
}
}
This function is applicable whichever mode of AD is being used.

## 3Description

x10aa_AD_f creates and initializes a configuration data object and returns a handle to the data object. This handle may then be passed to any routine in the NAG AD Library as listed in the Introduction to the NAG AD Library. The object must always be destroyed by a call to x10ab_AD_f prior to exiting the application in which it was created.
The returned handle can also be passed to x10ac_AD_f and x10ad_AD_f to respectively set and get the computational mode (see the X10 Chapter Introduction).

### 3.1Life 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_AD_f and destruction by x10ab_AD_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.
The handle is then passed to the computational routines of the NAG AD Library.
Note that separate configuration data objects can be initialized to contain different computational modes; for example, one handle for the symbolic computational mode (to be used when symbolic adjoints are possible and required) and one handle to contain the algorithmic computational mode.
When all AD computation is completed, the handle must be destroyed by x10ab_AD_f.

None.

## 5Arguments

1: $\mathbf{ad_handle}$Pointer to AD Data Output
Note: ad_handle does not need to be set on input.
On exit: holds a handle to the internal data structure where the computational AD configuration data, e.g., mode, is defined. You must not change the handle other than via NAG AD Library calls until it is destroyed by x10ab_AD_f.
2: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $0$ is recommended. When the value $-\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6Error Indicators and Warnings

If on entry ${\mathbf{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:
${\mathbf{ifail}}=2$
The user's version or configuration of dco/c++ is incompatible with this version of the NAG AD Library.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{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.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

Not applicable.