﻿ e02de Method
e02de calculates values of a bicubic spline from its B-spline representation.

# Syntax

C#
```public static void e02de(
int m,
int px,
int py,
double[] x,
double[] y,
double[] lamda,
double[] mu,
double[] c,
double[] ff,
out int ifail
)```
Visual Basic
```Public Shared Sub e02de ( _
m As Integer, _
px As Integer, _
py As Integer, _
x As Double(), _
y As Double(), _
lamda As Double(), _
mu As Double(), _
c As Double(), _
ff As Double(), _
<OutAttribute> ByRef ifail As Integer _
)```
Visual C++
```public:
static void e02de(
int m,
int px,
int py,
array<double>^ x,
array<double>^ y,
array<double>^ lamda,
array<double>^ mu,
array<double>^ c,
array<double>^ ff,
[OutAttribute] int% ifail
)```
F#
```static member e02de :
m : int *
px : int *
py : int *
x : float[] *
y : float[] *
lamda : float[] *
mu : float[] *
c : float[] *
ff : float[] *
ifail : int byref -> unit
```

#### Parameters

m
Type: System..::..Int32
On entry: $m$, the number of points at which values of the spline are required.
Constraint: ${\mathbf{m}}\ge 1$.
px
Type: System..::..Int32
On entry: px and py must specify the total number of knots associated with the variables $x$ and $y$ respectively. They are such that ${\mathbf{px}}-8$ and ${\mathbf{py}}-8$ are the corresponding numbers of interior knots.
Constraint: ${\mathbf{px}}\ge 8$ and ${\mathbf{py}}\ge 8$.
py
Type: System..::..Int32
On entry: px and py must specify the total number of knots associated with the variables $x$ and $y$ respectively. They are such that ${\mathbf{px}}-8$ and ${\mathbf{py}}-8$ are the corresponding numbers of interior knots.
Constraint: ${\mathbf{px}}\ge 8$ and ${\mathbf{py}}\ge 8$.
x
Type: array<System..::..Double>[]()[][]
An array of size [m]
On entry: x and y must contain ${x}_{\mathit{r}}$ and ${y}_{\mathit{r}}$, for $\mathit{r}=1,2,\dots ,m$, respectively. These are the coordinates of the points at which values of the spline are required. The order of the points is immaterial.
Constraint: ${\mathbf{x}}$ and ${\mathbf{y}}$ must satisfy
 $lamda[3]≤x[r-1]≤lamda[px-4]$
and
 $mu[3]≤y[r-1]≤mu[py-4], r=1,2,…,m.$
.
The spline representation is not valid outside these intervals.
y
Type: array<System..::..Double>[]()[][]
An array of size [m]
On entry: x and y must contain ${x}_{\mathit{r}}$ and ${y}_{\mathit{r}}$, for $\mathit{r}=1,2,\dots ,m$, respectively. These are the coordinates of the points at which values of the spline are required. The order of the points is immaterial.
Constraint: ${\mathbf{x}}$ and ${\mathbf{y}}$ must satisfy
 $lamda[3]≤x[r-1]≤lamda[px-4]$
and
 $mu[3]≤y[r-1]≤mu[py-4], r=1,2,…,m.$
.
The spline representation is not valid outside these intervals.
lamda
Type: array<System..::..Double>[]()[][]
An array of size [px]
On entry: lamda and mu must contain the complete sets of knots $\left\{\lambda \right\}$ and $\left\{\mu \right\}$ associated with the $x$ and $y$ variables respectively.
Constraint: the knots in each set must be in nondecreasing order, with ${\mathbf{lamda}}\left[{\mathbf{px}}-4\right]>{\mathbf{lamda}}\left[3\right]$ and ${\mathbf{mu}}\left[{\mathbf{py}}-4\right]>{\mathbf{mu}}\left[3\right]$.
mu
Type: array<System..::..Double>[]()[][]
An array of size [px]
On entry: lamda and mu must contain the complete sets of knots $\left\{\lambda \right\}$ and $\left\{\mu \right\}$ associated with the $x$ and $y$ variables respectively.
Constraint: the knots in each set must be in nondecreasing order, with ${\mathbf{lamda}}\left[{\mathbf{px}}-4\right]>{\mathbf{lamda}}\left[3\right]$ and ${\mathbf{mu}}\left[{\mathbf{py}}-4\right]>{\mathbf{mu}}\left[3\right]$.
c
Type: array<System..::..Double>[]()[][]
An array of size [$\left({\mathbf{px}}-4\right)×\left({\mathbf{py}}-4\right)$]
On entry: ${\mathbf{c}}\left[\left({\mathbf{py}}-4\right)×\left(\mathit{i}-1\right)+\mathit{j}-1\right]$ must contain the coefficient ${c}_{\mathit{i}\mathit{j}}$ described in [Description], for $\mathit{i}=1,2,\dots ,{\mathbf{px}}-4$ and $\mathit{j}=1,2,\dots ,{\mathbf{py}}-4$.
ff
Type: array<System..::..Double>[]()[][]
An array of size [m]
On exit: ${\mathbf{ff}}\left[\mathit{r}-1\right]$ contains the value of the spline at the point $\left({x}_{\mathit{r}},{y}_{\mathit{r}}\right)$, for $\mathit{r}=1,2,\dots ,m$.
ifail
Type: System..::..Int32%
On exit: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

# Description

e02de calculates values of the bicubic spline $s\left(x,y\right)$ at prescribed points $\left({x}_{\mathit{r}},{y}_{\mathit{r}}\right)$, for $\mathit{r}=1,2,\dots ,m$, from its augmented knot sets $\left\{\lambda \right\}$ and $\left\{\mu \right\}$ and from the coefficients ${c}_{ij}$, for $\mathit{i}=1,2,\dots ,{\mathbf{px}}-4$ and $\mathit{j}=1,2,\dots ,{\mathbf{py}}-4$, in its B-spline representation
 $sx,y=∑ijcijMixNjy.$
Here ${M}_{i}\left(x\right)$ and ${N}_{j}\left(y\right)$ denote normalized cubic B-splines, the former defined on the knots ${\lambda }_{i}$ to ${\lambda }_{i+4}$ and the latter on the knots ${\mu }_{j}$ to ${\mu }_{j+4}$.
This method may be used to calculate values of a bicubic spline given in the form produced by e01da (E02DAF not in this release) (E02DCF not in this release) (E02DDF not in this release). It is derived from the method B2VRE in Anthony et al. (1982).

# References

Anthony G T, Cox M G and Hayes J G (1982) DASL – Data Approximation Subroutine Library National Physical Laboratory
Cox M G (1978) The numerical evaluation of a spline from its B-spline representation J. Inst. Math. Appl. 21 135–143

# Error Indicators and Warnings

Errors or warnings detected by the method:
${\mathbf{ifail}}=1$
 On entry, ${\mathbf{m}}<1$, or ${\mathbf{py}}<8$, or ${\mathbf{px}}<8$.
${\mathbf{ifail}}=2$
On entry, the knots in array lamda, or those in array mu, are not in nondecreasing order, or ${\mathbf{lamda}}\left[{\mathbf{px}}-4\right]\le {\mathbf{lamda}}\left[3\right]$, or ${\mathbf{mu}}\left[{\mathbf{py}}-4\right]\le {\mathbf{mu}}\left[3\right]$.
${\mathbf{ifail}}=3$
On entry, at least one of the prescribed points $\left({x}_{r},{y}_{r}\right)$ lies outside the rectangle defined by ${\mathbf{lamda}}\left[3\right]$, ${\mathbf{lamda}}\left[{\mathbf{px}}-4\right]$ and ${\mathbf{mu}}\left[3\right]$, ${\mathbf{mu}}\left[{\mathbf{py}}-4\right]$.
${\mathbf{ifail}}=-9000$
An error occured, see message report.
${\mathbf{ifail}}=-8000$
Negative dimension for array $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$

# Accuracy

The method used to evaluate the B-splines is numerically stable, in the sense that each computed value of $s\left({x}_{r},{y}_{r}\right)$ can be regarded as the value that would have been obtained in exact arithmetic from slightly perturbed B-spline coefficients. See Cox (1978) for details.

None.

# Further Comments

Computation time is approximately proportional to the number of points, $m$, at which the evaluation is required.

# Example

This program reads in knot sets ${\mathbf{lamda}}\left[0\right],\dots ,{\mathbf{lamda}}\left[{\mathbf{px}}-1\right]$ and ${\mathbf{mu}}\left[0\right],\dots ,{\mathbf{mu}}\left[{\mathbf{py}}-1\right]$, and a set of bicubic spline coefficients ${c}_{ij}$. Following these are a value for $m$ and the coordinates $\left({x}_{\mathit{r}},{y}_{\mathit{r}}\right)$, for $\mathit{r}=1,2,\dots ,m$, at which the spline is to be evaluated.

Example program (C#): e02dee.cs

Example program data: e02dee.d

Example program results: e02dee.r