e01 Chapter Contents
e01 Chapter Introduction
NAG C Library Manual

# NAG Library Function Documentnag_3d_shep_eval (e01thc)

## 1  Purpose

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

## 2  Specification

 #include #include
 void nag_3d_shep_eval (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)

## 3  Description

nag_3d_shep_eval (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 nag_3d_shep_interp (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$.
nag_3d_shep_eval (e01thc) must only be called after a call to nag_3d_shep_interp (e01tgc).
This function is derived from the function QS3GRD described by Renka (1988).

## 4  References

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

## 5  Arguments

1:     mIntegerInput
2:     x[m]const doubleInput
3:     y[m]const doubleInput
4:     z[m]const doubleInput
5:     f[m]const doubleInput
On entry: m, x, y, z and f must be the same values as were supplied in the preceding call to nag_3d_shep_interp (e01tgc).
6:     iq[$\left(2×{\mathbf{m}}+1\right)$]const IntegerInput
On entry: must be unchanged from the value returned from a previous call to nag_3d_shep_interp (e01tgc).
7:     rq[$\left(10×{\mathbf{m}}+7\right)$]const doubleInput
On entry: must be unchanged from the value returned from a previous call to nag_3d_shep_interp (e01tgc).
8:     nIntegerInput
On entry: $n$, the number of evaluation points.
Constraint: ${\mathbf{n}}\ge 1$.
9:     u[n]const doubleInput
10:   v[n]const doubleInput
11:   w[n]const doubleInput
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:   q[n]doubleOutput
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 nag_real_largest_number (X02ALC)), and nag_3d_shep_eval (e01thc) returns with NE_BAD_POINT.
13:   qx[n]doubleOutput
14:   qy[n]doubleOutput
15:   qz[n]doubleOutput
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 nag_real_largest_number (X02ALC)), and nag_3d_shep_eval (e01thc) returns with NE_BAD_POINT.
16:   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.
On entry, at least one evaluation point lies outside the region of definition of the interpolant. At all such points the corresponding values in q, qx, qy and qz have been set to ${\mathbf{nag_real_largest_number}}$: ${\mathbf{nag_real_largest_number}}=〈\mathit{\text{value}}〉$.
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 nag_3d_shep_interp (e01tgc) and nag_3d_shep_eval (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.
NE_REAL_ARRAY
On entry, values in rq appear to be invalid. Check that rq has not been corrupted between calls to nag_3d_shep_interp (e01tgc) and nag_3d_shep_eval (e01thc).

## 7  Accuracy

Computational errors should be negligible in most practical situations.

The time taken for a call to nag_3d_shep_eval (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.