# NAG CL Interfacee01thc (dim3_​scat_​shep_​eval)

## 1Purpose

e01thc evaluates the three-dimensional interpolating function generated by e01tgc and its first partial derivatives.

## 2Specification

 #include
 void e01thc (Integer m, const double x[], const double y[], const double z[], const double f[], const Integer iq[], const double rq[], Integer n, const double u[], const double v[], const double w[], double q[], double qx[], double qy[], double qz[], NagError *fail)
The function may be called by the names: e01thc, nag_interp_dim3_scat_shep_eval or nag_3d_shep_eval.

## 3Description

e01thc takes as input the interpolant $Q\left(x,y,z\right)$ of a set of scattered data points $\left({x}_{r},{y}_{r},{z}_{r},{f}_{r}\right)$, for $\mathit{r}=1,2,\dots ,m$, as computed by e01tgc, and evaluates the interpolant and its first partial derivatives at the set of points $\left({u}_{i},{v}_{i},{w}_{i}\right)$, for $\mathit{i}=1,2,\dots ,n$.
e01thc must only be called after a call to e01tgc.
This function is derived from the function QS3GRD described by Renka (1988).

## 4References

Renka R J (1988) Algorithm 661: QSHEP3D: Quadratic Shepard method for trivariate interpolation of scattered data ACM Trans. Math. Software 14 151–152

## 5Arguments

1: $\mathbf{m}$Integer Input
2: $\mathbf{x}\left[{\mathbf{m}}\right]$const double Input
3: $\mathbf{y}\left[{\mathbf{m}}\right]$const double Input
4: $\mathbf{z}\left[{\mathbf{m}}\right]$const double Input
5: $\mathbf{f}\left[{\mathbf{m}}\right]$const double Input
On entry: m, x, y, z and f must be the same values as were supplied in the preceding call to e01tgc.
6: $\mathbf{iq}\left[\mathit{dim}\right]$const Integer Input
On entry: must be unchanged from the value returned from a previous call to e01tgc.
7: $\mathbf{rq}\left[\mathit{dim}\right]$const double Input
On entry: must be unchanged from the value returned from a previous call to e01tgc.
8: $\mathbf{n}$Integer Input
On entry: $n$, the number of evaluation points.
Constraint: ${\mathbf{n}}\ge 1$.
9: $\mathbf{u}\left[{\mathbf{n}}\right]$const double Input
10: $\mathbf{v}\left[{\mathbf{n}}\right]$const double Input
11: $\mathbf{w}\left[{\mathbf{n}}\right]$const double Input
On entry: ${\mathbf{u}}\left[\mathit{i}-1\right]$, ${\mathbf{v}}\left[\mathit{i}-1\right]$, ${\mathbf{w}}\left[\mathit{i}-1\right]$ must be set to the evaluation point $\left({u}_{\mathit{i}},{v}_{\mathit{i}},{w}_{\mathit{i}}\right)$, for $\mathit{i}=1,2,\dots ,n$.
12: $\mathbf{q}\left[{\mathbf{n}}\right]$double Output
On exit: ${\mathbf{q}}\left[\mathit{i}-1\right]$ contains the value of the interpolant, at $\left({u}_{\mathit{i}},{v}_{\mathit{i}},{w}_{\mathit{i}}\right)$, 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 the largest machine representable number (see X02ALC), and e01thc returns with ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_BAD_POINT.
13: $\mathbf{qx}\left[{\mathbf{n}}\right]$double Output
14: $\mathbf{qy}\left[{\mathbf{n}}\right]$double Output
15: $\mathbf{qz}\left[{\mathbf{n}}\right]$double Output
On exit: ${\mathbf{qx}}\left[\mathit{i}-1\right]$, ${\mathbf{qy}}\left[\mathit{i}-1\right]$, ${\mathbf{qz}}\left[\mathit{i}-1\right]$ contains the value of the partial derivatives of the interpolant $Q\left(x,y,z\right)$ at $\left({u}_{\mathit{i}},{v}_{\mathit{i}},{w}_{\mathit{i}}\right)$, 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 qx, qy and qz are set to the largest machine representable number (see X02ALC), and e01thc returns with ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_BAD_POINT.
16: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
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.
NE_INT
On entry, ${\mathbf{m}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{m}}\ge 10$.
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}\ge 1$.
NE_INT_ARRAY
On entry, values in iq appear to be invalid. Check that iq has not been corrupted between calls to e01tgc and e01thc.
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.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_REAL_ARRAY
On entry, values in rq appear to be invalid. Check that rq has not been corrupted between calls to e01tgc and e01thc.

## 7Accuracy

Computational errors should be negligible in most practical situations.

## 8Parallelism and Performance

e01thc is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
e01thc 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 function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

The time taken for a call to e01thc will depend in general on the distribution of the data points. If x, y and z are approximately uniformly distributed, then the time taken should be only $\mathit{O}\left({\mathbf{n}}\right)$. At worst $\mathit{O}\left({\mathbf{m}}{\mathbf{n}}\right)$ time will be required.