nag_2d_spline_ts_eval_rect (e02jfc) (PDF version)
e02 Chapter Contents
e02 Chapter Introduction
NAG Library Manual

# NAG Library Function Documentnag_2d_spline_ts_eval_rect (e02jfc)

## 1  Purpose

nag_2d_spline_ts_eval_rect (e02jfc) calculates a mesh of values of a spline computed by nag_2d_spline_fit_ts_scat (e02jdc).

## 2  Specification

 #include #include
 void nag_2d_spline_ts_eval_rect (Integer nxeval, Integer nyeval, const double xevalm[], const double yevalm[], const double coefs[], double fevalm[], const Integer iopts[], const double opts[], NagError *fail)

## 3  Description

nag_2d_spline_ts_eval_rect (e02jfc) calculates values on a rectangular mesh of a bivariate spline computed by nag_2d_spline_fit_ts_scat (e02jdc). The points in the mesh are defined by $x$ coordinates (${x}_{\mathit{i}}$), for $\mathit{i}=1,2,\dots ,{n}_{x}$, and $y$ coordinates (${y}_{\mathit{j}}$), for $\mathit{j}=1,2,\dots ,{n}_{y}$. This function is derived from the TSFIT package of O. Davydov and F. Zeilfelder.

## 4  References

Davydov O, Morandi R and Sestini A (2006) Local hybrid approximation for scattered data fitting with bivariate splines Comput. Aided Geom. Design 23 703–721
Davydov O, Sestini A and Morandi R (2005) Local RBF approximation for scattered data fitting with bivariate splines Trends and Applications in Constructive Approximation M. G. de Bruin, D. H. Mache, and J. Szabados, Eds ISNM Vol. 151 Birkhauser 91–102
Davydov O and Zeilfelder F (2004) Scattered data fitting by direct extension of local polynomials to bivariate splines Advances in Comp. Math. 21 223–271
Farin G and Hansford D (2000) The Essentials of CAGD Natic, MA: A K Peters, Ltd.

## 5  Arguments

1:    $\mathbf{nxeval}$IntegerInput
On entry: ${n}_{x}$, the number of values in the $x$ direction forming the mesh on which the spline is to be evaluated.
Constraint: ${\mathbf{nxeval}}\ge 1$.
2:    $\mathbf{nyeval}$IntegerInput
On entry: ${n}_{y}$, the number of values in the $y$ direction forming the mesh on which the spline is to be evaluated.
Constraint: ${\mathbf{nyeval}}\ge 1$.
3:    $\mathbf{xevalm}\left[{\mathbf{nxeval}}\right]$const doubleInput
On entry: the $\left({x}_{i}\right)$ values forming the mesh on which the spline is to be evaluated.
Constraint: for all $i$, ${\mathbf{xevalm}}\left[i-1\right]$ must lie inside, or on the boundary of, the spline's bounding box as determined by nag_2d_spline_fit_ts_scat (e02jdc).
4:    $\mathbf{yevalm}\left[{\mathbf{nyeval}}\right]$const doubleInput
On entry: the $\left({y}_{j}\right)$ values forming the mesh on which the spline is to be evaluated.
Constraint: for all $j$, ${\mathbf{yevalm}}\left[j-1\right]$ must lie inside, or on the boundary of, the spline's bounding box as determined by nag_2d_spline_fit_ts_scat (e02jdc).
5:    $\mathbf{coefs}\left[\mathit{dim}\right]$const doubleCommunication Array
Note: the dimension, $\mathit{dim}$, of this array is dictated by the requirements of associated functions that must have been previously called. This array MUST be the same array passed as argument coefs in the previous call to nag_2d_spline_fit_ts_scat (e02jdc).
On entry: the computed spline coefficients as output from nag_2d_spline_fit_ts_scat (e02jdc).
6:    $\mathbf{fevalm}\left[{\mathbf{nxeval}}×{\mathbf{nyeval}}\right]$doubleOutput
Note: the $\left(i,j\right)$th element of the matrix is stored in ${\mathbf{fevalm}}\left[\left(j-1\right)×{\mathbf{nxeval}}+i-1\right]$.
On exit: if ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_NOERROR on exit ${\mathbf{fevalm}}\left[\left(j-1\right)×{\mathbf{nxeval}}+i-1\right]$ contains the computed spline value at $\left({x}_{i},{y}_{j}\right)$.
7:    $\mathbf{iopts}\left[\mathit{dim}\right]$const IntegerCommunication Array
Note: the dimension, $\mathit{dim}$, of this array is dictated by the requirements of associated functions that must have been previously called. This array MUST be the same array passed as argument iopts in the previous call to nag_fit_opt_set (e02zkc).
On entry: the contents of the array MUST NOT have been modified either directly or indirectly, by a call to nag_fit_opt_set (e02zkc), between calls to nag_2d_spline_fit_ts_scat (e02jdc) and nag_2d_spline_ts_eval_rect (e02jfc).
8:    $\mathbf{opts}\left[\mathit{dim}\right]$const doubleCommunication Array
Note: the dimension, $\mathit{dim}$, of this array is dictated by the requirements of associated functions that must have been previously called. This array MUST be the same array passed as argument opts in the previous call to nag_fit_opt_set (e02zkc).
On entry: the contents of the array MUST NOT have been modified either directly or indirectly, by a call to nag_fit_opt_set (e02zkc), between calls to nag_2d_spline_fit_ts_scat (e02jdc) and nag_2d_spline_ts_eval_rect (e02jfc).
9:    $\mathbf{fail}$NagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

## 6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.2.1.2 in the Essential Introduction for further information.
NE_BAD_PARAM
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_INITIALIZATION
Option arrays are not initialized or are corrupted.
NE_INT
On entry, ${\mathbf{nxeval}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{nxeval}}\ge 1$.
On entry, ${\mathbf{nyeval}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{nyeval}}\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 3.6.6 in the Essential Introduction for further information.
NE_INVALID_SPLINE
The fitting routine has not been called, or the array of coefficients has been corrupted.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 3.6.5 in the Essential Introduction for further information.
NE_POINT_OUTSIDE_RECT
On entry, ${\mathbf{xevalm}}\left[〈\mathit{\text{value}}〉\right]=〈\mathit{\text{value}}〉$ was outside the bounding box.
Constraint: $〈\mathit{\text{value}}〉\le {\mathbf{xevalm}}\left[i-1\right]\le 〈\mathit{\text{value}}〉$ for all $i$.
On entry, ${\mathbf{yevalm}}\left[〈\mathit{\text{value}}〉\right]=〈\mathit{\text{value}}〉$ was outside the bounding box.
Constraint: $〈\mathit{\text{value}}〉\le {\mathbf{yevalm}}\left[j-1\right]\le 〈\mathit{\text{value}}〉$ for all $j$.

## 7  Accuracy

nag_2d_spline_ts_eval_rect (e02jfc) uses the de Casteljau algorithm and thus is numerically stable. See Farin and Hansford (2000) for details.

Not applicable.

## 9  Further Comments

To evaluate a ${C}^{1}$ approximation (i.e., when ${\mathbf{Global Smoothing Level}}=1$), a real array of length $\mathit{O}\left(1\right)$ is dynamically allocated by each invocation of nag_2d_spline_ts_eval_rect (e02jfc). No memory is allocated internally when evaluating a ${C}^{2}$ approximation.

## 10  Example

See Section 10 in nag_2d_spline_fit_ts_scat (e02jdc).

nag_2d_spline_ts_eval_rect (e02jfc) (PDF version)
e02 Chapter Contents
e02 Chapter Introduction
NAG Library Manual