The routine may be called by the names e01znf or nagf_interp_dimn_scat_shep_eval.
3Description
e01znf takes as input the interpolant $Q\left(\mathbf{x}\right)$, $\mathbf{x}\in {\mathbb{R}}^{d}$ of a set of scattered data points $({\mathbf{x}}_{\mathit{r}},{f}_{\mathit{r}})$, for $\mathit{r}=1,2,\dots ,m$, as computed by e01zmf, and evaluates the interpolant and its first partial derivatives at the set of points ${\mathbf{x}}_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,n$.
e01znf must only be called after a call to
e01zmf.
e01znf is derived from the new implementation of QS3GRD described by Renka (1988). It uses the modification for high-dimensional interpolation described by Berry and Minser (1999).
4References
Berry M W, Minser K S (1999) Algorithm 798: high-dimensional interpolation using the modified Shepard method ACM Trans. Math. Software25 353–366
Renka R J (1988) Algorithm 661: QSHEP3D: Quadratic Shepard method for trivariate interpolation of scattered data ACM Trans. Math. Software14 151–152
5Arguments
1: $\mathbf{d}$ – IntegerInput
On entry: must be the same value supplied for argument d in the preceding call to e01zmf.
Constraint:
${\mathbf{d}}\ge 2$.
2: $\mathbf{m}$ – IntegerInput
On entry: must be the same value supplied for argument m in the preceding call to e01zmf.
On entry: must be the same array returned as argument iq in the preceding call to e01zmf. It must remain unchanged between calls.
6: $\mathbf{rq}(*)$ – Real (Kind=nag_wp) arrayInput
Note: the dimension of the array rq
must be at least
$(({\mathbf{d}}+1)\times ({\mathbf{d}}+2)/2)\times {\mathbf{m}}+2\times {\mathbf{d}}+1$.
On entry: must be the same array returned as argument rq in the preceding call to e01zmf. It must remain unchanged between calls.
7: $\mathbf{n}$ – IntegerInput
On entry: $n$, the number of evaluation points.
Constraint:
${\mathbf{n}}\ge 1$.
8: $\mathbf{xe}({\mathbf{d}},{\mathbf{n}})$ – Real (Kind=nag_wp) arrayInput
Note: the $i$th ordinate of the point ${x}_{j}$ is stored in ${\mathbf{xe}}(i,j)$.
On entry: ${\mathbf{xe}}(1:{\mathbf{d}},\mathit{j})$ must be set to the evaluation point ${\mathbf{x}}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,n$.
9: $\mathbf{q}\left({\mathbf{n}}\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: ${\mathbf{q}}\left(\mathit{i}\right)$ contains the value of the interpolant, at ${\mathbf{x}}_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,n$. If any of these evaluation points lie outside the region of definition of the interpolant the corresponding entries in q are set to an extrapolated approximation, and e01znf returns with ${\mathbf{ifail}}={\mathbf{3}}$.
10: $\mathbf{qx}({\mathbf{d}},{\mathbf{n}})$ – Real (Kind=nag_wp) arrayOutput
On exit: ${\mathbf{qx}}(i,j)$ contains the value of the partial derivatives with respect to the $i$th independent variable (dimension) of the interpolant $Q\left(\mathbf{x}\right)$ at
${\mathbf{x}}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,n$, and for each of the partial derivatives $i=1,2,\dots ,d$. If any of these evaluation points lie outside the region of definition of the interpolant, the corresponding entries in qx are set to extrapolated approximations to the partial derivatives, and e01znf returns with ${\mathbf{ifail}}={\mathbf{3}}$.
11: $\mathbf{ifail}$ – IntegerInput/Output
On entry: ifail must be set to $0$, $\mathrm{-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 $\mathrm{-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 $\mathrm{-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 $\mathrm{-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}}=1$
On entry, ${\mathbf{d}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{d}}\ge 2$.
On entry, $(({\mathbf{d}}+1)\times ({\mathbf{d}}+2)/2)\times {\mathbf{m}}+2\times {\mathbf{d}}+1$ exceeds the largest machine integer. ${\mathbf{d}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{m}}=\u27e8\mathit{\text{value}}\u27e9$.
On entry, ${\mathbf{m}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{d}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{m}}\ge ({\mathbf{d}}+1)\times ({\mathbf{d}}+2)/2+2$.
On entry, ${\mathbf{n}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{n}}\ge 1$.
${\mathbf{ifail}}=2$
On entry, values in iq appear to be invalid. Check that iq has not been corrupted between calls to e01zmf and e01znf.
On entry, values in rq appear to be invalid. Check that rq has not been corrupted between calls to e01zmf and e01znf.
${\mathbf{ifail}}=3$
On entry, at least one evaluation point lies outside the region of definition of the interpolant. At such points the corresponding values in q and qx contain extrapolated approximations. Points should be evaluated one by one to identify extrapolated values.
${\mathbf{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.
${\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.
7Accuracy
Computational errors should be negligible in most practical situations.
8Parallelism and Performance
e01znf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
e01znf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
9Further Comments
The time taken for a call to e01znf will depend in general on the distribution of the data points. If the data points are approximately uniformly distributed, then the time taken should be only $\mathit{O}\left(n\right)$. At worst $\mathit{O}\left(mn\right)$
time will be required.
9.1Internal Changes
Internal changes have been made to this routine as follows:
At Mark 26.0: The algorithm used by this routine, based on a Modified Shepard method, has been changed to produce more reliable results for some data sets which were previously not well handled. In addition, handling of evaluation points which are far away from the original data points has been improved by use of an extrapolation method which returns useful results rather than just an error message as was done at earlier Marks.
At Mark 26.1: The algorithm has undergone further changes which enable it to work better on certain data sets, for example data presented on a regular grid. The results returned when evaluating the function at points which are not in the original data set used to construct the interpolating function are now likely to be slightly different from those returned at previous Marks of the Library, but the function still interpolates the original data.
For details of all known issues which have been reported for the NAG Library please refer to the Known Issues.
10Example
This program evaluates the function (in six variables)
at a set of randomly generated data points and calls e01zmf to construct an interpolating function ${Q}_{x}$. It then calls e01znf to evaluate the interpolant at a set of points on the line ${x}_{i}=x$, for $\mathit{i}=1,2,\dots ,6$. To reduce the time taken by this example, the number of data points is limited. Increasing this value to the suggested minimum of $4000$ improves the interpolation accuracy at the expense of more time.