KPG1_MTHEx

Evaluates a mathematical expression for a set of data and variance arrays

Description:

The routine evaluates a general mathematical expression giving the values in an output data array in terms of values in a set of input data arrays, each of the same size. The expression to be evaluated is specified by means of a mapping identifier obtained from the TRANSFORM system (see SUN/61). A set of input variance arrays is also supplied, and this routine uses these to obtain estimates of the variance in the evaluated results. These output variance estimates are obtained numerically by perturbing the input data values by appropriate amounts.

Invocation

CALL KPG1_MTHEx( BAD, EL, N, DAT, VFLAG, VAR, IMAP, QUICK, MXBAT, WRK, RES, VRES, BADDR, BADVR, STATUS )

Arguments

BAD = LOGICAL (Given)
Whether it is necessary to check for bad values in the input data or variance arrays.
EL = INTEGER (Given)
Number of elements in each input data array.
N = INTEGER (Given)
Number of input data arrays.
DAT( EL, N ) = ? (Given)
Array containing each separate input data array stored in a separate row.
VFLAG( N ) = LOGICAL (Given)
A set of logical flags indicating which of the input data arrays stored in the DAT array have associated variance values (stored in the VAR array). If the VFLAG value for a data array is .TRUE., then variance values exist, otherwise there is no associated variance array so a variance of zero will be assumed.
VAR( EL, ) = ? (Given)
Array containing variance estimates for the input data arrays. These values are stored in the rows of this array in the same order as the associated data values, but the total number of rows may be smaller than N due to the absence of values for those data arrays with a VFLAG value of .FALSE.. The declared second dimension size of the VAR array must be at least equal to the number of .TRUE. values in the VFLAG array.
IMAP = INTEGER (Given)
A TRANSFORM system identifier for an {N– >1} compiled mapping which defines the mathematical expression to be evaluated.
QUICK = LOGICAL (Given)
If this argument is set to .TRUE., then output variance estimates will be made by perturbing each input data array in turn, but in the positive direction only. If it is set to .FALSE., then each input data array will be perturbed in both directions and the maximum resulting output perturbation will be used to estimate the output variance. The former approach has the advantage of speed, but the latter gives more accurate results, especially for highly non-linear functions.
MXBAT = INTEGER (Given)
A positive integer defining the size of workspace supplied. The input data arrays will be processed in " batches" , each of which does not contain more than this number of elements. If this value is too low, then excessive time will be spent in looping and subroutine calls. If it is too high, then excessive page faulting may occur. A value of about 256 is normally adequate.
WRK( MXBAT ( N + 3 ) ) = ? (Returned)
This array must be supplied as workspace.
RES( EL ) = ? (Returned)
The output data array, containing the results of evaluating the mathematical expression.
VRES( EL ) = ? (Returned)
The output variance estimates to accompany the results held in the RES array.
BADDR = LOGICAL (Returned)
Whether the returned array of results (RES) may contain bad values.
BADVR = LOGICAL (Returned)
Whether the returned array of variance estimates (VRES) may contain bad values.
STATUS = INTEGER (Given and Returned)
The global status.

Notes:

Timing

The time taken is approximately proportional to (i) N+1, where N is the number of input data arrays which have associated variance values, (ii) the size of each array and (iii) the time taken to evaluate the mathematical expression for each array element. In general, this last value will also tend to increase in approximate proportion to the number of input data arrays.