Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_correg_optget (g02zl)

Purpose

nag_correg_optget (g02zl) is used to query the value of optional parameters available to supported problem solving functions in Chapter G02. Currently, only nag_correg_quantile_linreg (g02qg) is supported.

Syntax

[ivalue, rvalue, cvalue, optype, ifail] = g02zl(optstr, iopts, opts)
[ivalue, rvalue, cvalue, optype, ifail] = nag_correg_optget(optstr, iopts, opts)

Description

nag_correg_optget (g02zl) is used to query the current values of options. It is necessary to initalize optional parameter arrays using nag_correg_optset (g02zk) before any options are queried.
nag_correg_optget (g02zl) will normally return either an integer, real or character value dependent upon the type associated with the optional parameter being queried. Whether the option queried is of integer, real or character type is indicated by the returned value of optype.
Information on optional parameter names and whether these options are real, integer or character can be found in Optional Parameters in nag_correg_quantile_linreg (g02qg).

None.

Parameters

Compulsory Input Parameters

1:     $\mathrm{optstr}$ – string
A string identifying the option whose current value is required. See Optional Parameters in nag_correg_quantile_linreg (g02qg) for information on valid options. In addition, the following is a valid option:
$\mathbf{Identify}$
nag_correg_optget (g02zl) returns in cvalue the function name supplied to nag_correg_optset (g02zk) when the optional parameter arrays iopts and opts were initialized.
2:     $\mathrm{iopts}\left(:\right)$int64int32nag_int array
Note: the dimension of this array is dictated by the requirements of associated functions that must have been previously called. This array must be the same array passed as argument iopts in the previous call to nag_correg_optset (g02zk).
3:     $\mathrm{opts}\left(:\right)$ – double array
Note: the dimension of this array is dictated by the requirements of associated functions that must have been previously called. This array must be the same array passed as argument opts in the previous call to nag_correg_optset (g02zk).

None.

Output Parameters

1:     $\mathrm{ivalue}$int64int32nag_int scalar
If the optional parameter supplied in optstr is an integer valued argument, ivalue will hold its current value.
2:     $\mathrm{rvalue}$ – double scalar
If the optional parameter supplied in optstr is a real valued argument, rvalue will hold its current value.
3:     $\mathrm{cvalue}$ – string
Note: the string returned in cvalue will never exceed $40$ characters in length.
If the optional parameter supplied in optstr is a character valued argument, cvalue will hold its current value, unless Identify is specified, see optstr.
4:     $\mathrm{optype}$int64int32nag_int scalar
Indicates whether the optional parameter supplied in optstr is an integer, real or character valued argument and hence which of ivalue, rvalue or cvalue holds the current value.
${\mathbf{optype}}=1$
optstr is an integer valued optional parameter, its current value has been returned in ivalue.
${\mathbf{optype}}=2$
optstr is a real valued optional parameter, its current value has been returned in rvalue.
${\mathbf{optype}}=3$
optstr is a character valued optional parameter, its current value has been returned in cvalue.
5:     $\mathrm{ifail}$int64int32nag_int scalar
${\mathbf{ifail}}={\mathbf{0}}$ unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
${\mathbf{ifail}}=11$
On entry, the option in optstr was not recognized.
${\mathbf{ifail}}=41$
On entry, optstr indicates a character optional parameter, but cvalue is too short to hold the stored value. The returned value will be truncated.
${\mathbf{ifail}}=61$
On entry, either the option arrays have not been initialized or they have been corrupted.
${\mathbf{ifail}}=-99$
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.

Not applicable.

Not applicable.

Example

See the example programs associated with the problem solving function you wish to use for a demonstration of how to use nag_correg_optget (g02zl) to query options.
```function g02zl_example

fprintf('g02zl example results\n\n');

iopts = zeros(100, 1, 'int64');
opts = zeros(100, 1);
% Initialize the optional argument array
[iopts, opts, ifail] = g02zk( ...
'Initialize = g02qg', iopts, opts);

% Retrieve default values of some optional arguments
disp('Default optional values for selected options are:');
stropts = {'Iteration Limit', 'Epsilon', 'Return Residuals'};
formd = '%-30s : %8d\n';
formr = '%-30s : %8.2e\n';
forms = '%-30s : %8s\n';
for j = 1:3
[ivalue, rvalue, cvalue, optype, ifail] = ...
g02zl( ...
stropts{j}, iopts, opts);
if optype==1
fprintf(formd,stropts{j},ivalue);
elseif optype==2
fprintf(formr,stropts{j},rvalue);
else
fprintf(forms,stropts{j},cvalue);
end
end

```
```g02zl example results

Default optional values for selected options are:
Iteration Limit                :      100
Epsilon                        : 1.05e-08
Return Residuals               :      NO
```