nag_2d_shep_eval (e01shc) (PDF version)
e01 Chapter Contents
e01 Chapter Introduction
NAG Library Manual

# NAG Library Function Documentnag_2d_shep_eval (e01shc)

## 1  Purpose

nag_2d_shep_eval (e01shc) evaluates the two-dimensional interpolating function generated by nag_2d_shep_interp (e01sgc) and its first partial derivatives.

## 2  Specification

 #include #include
 void nag_2d_shep_eval (Integer m, const double x[], const double y[], const double f[], const Integer iq[], const double rq[], Integer n, const double u[], const double v[], double q[], double qx[], double qy[], NagError *fail)

## 3  Description

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

## 4  References

Renka R J (1988) Algorithm 660: QSHEP2D: Quadratic Shepard method for bivariate interpolation of scattered data ACM Trans. Math. Software 14 149–150

## 5  Arguments

1:    $\mathbf{m}$IntegerInput
2:    $\mathbf{x}\left[{\mathbf{m}}\right]$const doubleInput
3:    $\mathbf{y}\left[{\mathbf{m}}\right]$const doubleInput
4:    $\mathbf{f}\left[{\mathbf{m}}\right]$const doubleInput
On entry: m, x, y and f must be the same values as were supplied in the preceding call to nag_2d_shep_interp (e01sgc).
5:    $\mathbf{iq}\left[\left(2×{\mathbf{m}}+1\right)\right]$const IntegerInput
On entry: must be unchanged from the value returned from a previous call to nag_2d_shep_interp (e01sgc).
6:    $\mathbf{rq}\left[\left(6×{\mathbf{m}}+5\right)\right]$const doubleInput
On entry: must be unchanged from the value returned from a previous call to nag_2d_shep_interp (e01sgc).
7:    $\mathbf{n}$IntegerInput
On entry: $n$, the number of evaluation points.
Constraint: ${\mathbf{n}}\ge 1$.
8:    $\mathbf{u}\left[{\mathbf{n}}\right]$const doubleInput
9:    $\mathbf{v}\left[{\mathbf{n}}\right]$const doubleInput
On entry: the evaluation points $\left({u}_{\mathit{i}},{v}_{\mathit{i}}\right)$, for $\mathit{i}=1,2,\dots ,n$.
10:  $\mathbf{q}\left[{\mathbf{n}}\right]$doubleOutput
On exit: the values of the interpolant at $\left({u}_{\mathit{i}},{v}_{\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_2d_shep_eval (e01shc) returns with ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_BAD_INTERPOLANT.
11:  $\mathbf{qx}\left[{\mathbf{n}}\right]$doubleOutput
12:  $\mathbf{qy}\left[{\mathbf{n}}\right]$doubleOutput
On exit: the values of the partial derivatives of the interpolant $Q\left(x,y\right)$ at $\left({u}_{\mathit{i}},{v}_{\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 and qy are set to the largest machine representable number (see nag_real_largest_number (X02ALC)), and nag_2d_shep_eval (e01shc) returns with ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_BAD_INTERPOLANT.
13:  $\mathbf{fail}$NagError *Input/Output
The NAG error argument (see Section 2.7 in How to Use the NAG Library and its Documentation).

## 6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
NE_BAD_INTERPOLANT
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 and qy have been set to ${\mathbf{nag_real_largest_number}}=〈\mathit{\text{value}}〉$.
NE_BAD_PARAM
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_INT
On entry, ${\mathbf{m}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{m}}\ge 6$.
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}\ge 1$.
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.
An unexpected error has been triggered by this function. Please contact NAG.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_INVALID_ARRAY
On entry, values in iq appear to be invalid. Check that iq has not been corrupted between calls to nag_2d_shep_interp (e01sgc) and nag_2d_shep_eval (e01shc).
On entry, values in rq appear to be invalid. Check that rq has not been corrupted between calls to nag_2d_shep_interp (e01sgc) and nag_2d_shep_eval (e01shc).
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.

## 7  Accuracy

Computational errors should be negligible in most practical situations.

## 8  Parallelism and Performance

nag_2d_shep_eval (e01shc) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
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.

## 9  Further Comments

The time taken for a call to nag_2d_shep_eval (e01shc) will depend in general on the distribution of the data points. If x and y 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.

## 10  Example

See Section 10 in nag_2d_shep_interp (e01sgc).

nag_2d_shep_eval (e01shc) (PDF version)
e01 Chapter Contents
e01 Chapter Introduction
NAG Library Manual