d01 Chapter Contents
d01 Chapter Introduction
NAG Library Manual

# NAG Library Function Documentnag_quad_opt_set (d01zkc)

## 1  Purpose

nag_quad_opt_set (d01zkc) either initializes or resets the optional argument arrays or sets a single optional argument for supported problem solving functions in Chapter d01. Currently only nag_quad_1d_gen_vec_multi_rcomm (d01rac) is supported.

## 2  Specification

 #include #include
 void nag_quad_opt_set (const char *optstr, Integer iopts[], Integer liopts, double opts[], Integer lopts, NagError *fail)

## 3  Description

nag_quad_opt_set (d01zkc) has three purposes: to initialize optional argument arrays; to reset all optional arguments to their default values; or to set a single optional argument to a user-supplied value.
Optional arguments and their values are, in general, presented as a character string, optstr, of the form ‘option $\text{}=\mathit{optval}$’; alphabetic characters can be supplied in either upper or lower case. Both option and $\mathit{optval}$ may consist of one or more tokens separated by white space. The tokens that comprise $\mathit{optval}$ will normally be either an integer, real or character value as defined in the description of the specific optional argument. In addition all optional arguments can take an $\mathit{optval}$ DEFAULT which resets the optional argument to its default value.
It is imperative that optional argument arrays are initialized before any options are set, before the relevant problem solving function is called and before any options are queried using nag_quad_opt_get (d01zlc). To initialize the optional argument arrays iopts and opts for a specific problem solving function, the option Initialize is used with optval identifying the problem solving function to be called, via its short name. For example, to initialize the optional argument arrays to be passed to nag_quad_1d_gen_vec_multi_rcomm (d01rac) and its associated function nag_quad_1d_gen_vec_multi_dimreq (d01rcc), nag_quad_opt_set (d01zkc) is called as follows:
```nag_quad_opt_set("Initialize = d01rac", iopts, liopts, opts, lopts, &fail)
```
The available option names and their corresponding valid values are given in Section 11 in nag_quad_1d_gen_vec_multi_rcomm (d01rac).

None.

## 5  Arguments

1:     optstrconst char *Input
On entry: a string identifying the option to be set.
$\mathbf{Initialize}=\mathit{function name}$
Initialize the optional argument arrays iopts and opts for use with function $\mathit{function name}$, where $\mathit{function name}$ is the short name associated with the function of interest.
$\mathbf{Defaults}$
Resets all options to their default values.
$\mathit{option}=\mathit{optval}$
See Section 11 in nag_quad_1d_gen_vec_multi_rcomm (d01rac) for details of valid values for option and optval. The equals sign ($=$) delimiter must be used to separate the option from its optval value.
optstr is case insensitive. Each token in the option and optval component must be separated by at least one space.
2:     iopts[liopts]IntegerCommunication Array
On entry: optional argument array.
If optstr has the form ${\mathbf{Initialize}}=\mathit{function name}$, the contents of iopts need not be set.
Otherwise, iopts MUST NOT have been altered since the last call to nag_quad_opt_set (d01zkc), nag_quad_opt_get (d01zlc) or the selected problem solving function.
On exit: dependent on the contents of optstr, either an initialized, reset or updated version of the optional argument array.
3:     lioptsIntegerInput
On entry: the length of the array iopts.
Constraint: unless otherwise stated in the documentation for a specific, supported, problem solving function, ${\mathbf{liopts}}\ge 100$.
4:     opts[lopts]doubleCommunication Array
On entry: optional argument array.
If optstr has the form ${\mathbf{Initialize}}=\mathit{function name}$, the contents of opts need not be set.
Otherwise, opts MUST NOT have been altered since the last call to nag_quad_opt_set (d01zkc), nag_quad_opt_get (d01zlc) or the selected problem solving function.
On exit: dependent on the contents of optstr, either an initialized, reset or updated version of the optional argument array.
5:     loptsIntegerInput
On entry: the length of the array opts.
Constraint: unless otherwise stated in the documentation for a specific, supported, problem solving function, ${\mathbf{lopts}}\ge 100$.
6:     failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

## 6  Error Indicators and Warnings

On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_INT
On entry, ${\mathbf{liopts}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{liopts}}\ge ⟨\mathit{\text{value}}⟩$.
On entry, ${\mathbf{lopts}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{lopts}}\ge ⟨\mathit{\text{value}}⟩$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
NE_INVALID_FORMAT
On entry, could not convert the specified optval to an integer: ${\mathbf{optstr}}="⟨\mathit{\text{value}}⟩"$.
On entry, could not convert the specified optval to a real: ${\mathbf{optstr}}="⟨\mathit{\text{value}}⟩"$.
On entry, the expected delimiter ‘$=$’ was not found in optstr: ${\mathbf{optstr}}="⟨\mathit{\text{value}}⟩"$.
NE_INVALID_OPTION
On entry, either the option arrays have not been initialized or they have been corrupted.
On entry, the optional argument in optstr was not recognized: ${\mathbf{optstr}}="⟨\mathit{\text{value}}⟩"$.
NE_INVALID_VALUE
On entry, the optval supplied for the character optional argument is not valid.
${\mathbf{optstr}}="⟨\mathit{\text{value}}⟩"$.
On entry, the optval supplied for the integer optional argument is not valid.
${\mathbf{optstr}}="⟨\mathit{\text{value}}⟩"$.
On entry, the optval supplied for the real optional argument is not valid.
${\mathbf{optstr}}="⟨\mathit{\text{value}}⟩"$.
NE_NOT_FUN_NAME
On entry, attempting to initialize the optional argument arrays but specified function name was not valid: $\text{name}="⟨\mathit{\text{value}}⟩"$.

Not applicable.

Not applicable.

## 9  Further Comments

For suites of functions that share the same option arrays, the option arrays must be initialized using the primary (driver) function name.
For example for functions nag_quad_1d_gen_vec_multi_rcomm (d01rac) and nag_quad_1d_gen_vec_multi_dimreq (d01rcc), the option arrays must be initialized for nag_quad_1d_gen_vec_multi_rcomm (d01rac).
When encoding integer valued options in optstr, the integer $\mathit{optval}$ must be written as an explicit integer. For example, "Maximum Subdivisions = 12" is acceptable, whereas "Maximum Subdivisions = 12.0" and "Maximum Subdivisions = 0.12e2" are not.
When encoding real valued options in optstr, the $\mathit{optval}$ may be integral if appropriate. For example, "Absolute Tolerance = 10", "Absolute Tolerance = 10.0" and "Absolute Tolerance = 1.0e1" are all acceptable.

## 10  Example

See the example programs associated with the problem solving function you wish to use for a demonstration of how to use nag_quad_opt_set (d01zkc) to initialize option arrays and set options.