NAG CL Interface
e02dfc (dim2_spline_evalm)
1
Purpose
e02dfc calculates values of a bicubic spline from its B-spline representation. The spline is evaluated at all points on a rectangular grid.
2
Specification
void |
e02dfc (Integer mx,
Integer my,
const double x[],
const double y[],
double ff[],
Nag_2dSpline *spline,
NagError *fail) |
|
The function may be called by the names: e02dfc, nag_fit_dim2_spline_evalm or nag_2d_spline_eval_rect.
3
Description
e02dfc calculates values of the bicubic spline
on a rectangular grid of points in the
-
plane, from its augmented knot sets
and
and from the coefficients
, for
and
, in its B-spline representation
Here
and
denote normalized cubic B-splines, the former defined on the knots
to
and the latter on the knots
to
.
The points in the grid are defined by coordinates , for , along the axis, and coordinates , for along the axis.
This function may be used to calculate values of a bicubic spline given in the form produced by
e01dac,
e02dcc and
e02ddc. It is derived from the routine B2VRE in
Anthony et al. (1982).
4
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
5
Arguments
-
1:
– Integer
Input
-
2:
– Integer
Input
-
On entry:
mx and
my must specify
and
respectively, the number of points along the
and
axes that define the rectangular grid.
Constraint:
and .
-
3:
– const double
Input
-
4:
– const double
Input
-
On entry:
x and
y must contain
, for
, and
, for
, respectively. These are the
and
coordinates that define the rectangular grid of points at which values of the spline are required.
Constraint:
x and
y must satisfy
, for
, and
, for
.
The spline representation is not valid outside these intervals.
-
5:
– double
Output
-
On exit: contains the value of the spline at the point , for and .
-
6:
– Nag_2dSpline *
-
Pointer to structure of type Nag_2dSpline with the following members:
- nx – IntegerInput
-
On entry: must specify the total number of knots associated with the variable . It is such that is the number of interior knots.
Constraint:
.
- lamda – double *Input
-
On entry: a pointer to which memory of size must be allocated. must contain the complete sets of knots associated with the variable.
Constraint:
the knots must be in nondecreasing order, with .
- ny – IntegerInput
-
On entry: must specify the total number of knots associated with the variable .
It is such that is the number of interior knots.
Constraint:
.
- mu – double *Input
-
On entry: a pointer to which memory of size must be allocated. must contain the complete sets of knots associated with the variable.
Constraint:
the knots must be in nondecreasing order, with .
- c – double *Input
-
On entry: a pointer to which memory of size
must be allocated.
must contain the coefficient
described in
Section 3, for
and
.
In normal usage, the call to
e02dfc follows a call to
e01dac,
e02dcc or
e02ddc, in which case, members of the structure
spline will have been set up correctly for input to
e02dfc.
-
7:
– NagError *
Input/Output
-
The NAG error argument (see
Section 7 in the Introduction to the NAG Library CL Interface).
6
Error Indicators and Warnings
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
- NE_END_KNOTS_CONS
-
On entry, the end knots must satisfy : , .
- NE_INT_ARG_LT
-
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, must not be less than 8: .
On entry, must not be less than 8: .
- NE_KNOTS_COORD_CONS
-
On entry, the end knots and coordinates must satisfy and . , , , .
On entry, the end knots and coordinates must satisfy and . , , , .
- NE_NOT_INCREASING
-
The sequence is not increasing: , .
The sequence is not increasing: , .
- NE_NOT_STRICTLY_INCREASING
-
The sequence
x is not strictly increasing:
,
.
The sequence
y is not strictly increasing:
,
.
7
Accuracy
The method used to evaluate the B-splines is numerically stable, in the sense that each computed value of
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.
8
Parallelism and Performance
e02dfc is not threaded in any implementation.
Computation time is approximately proportional to .
10
Example
This program reads in knot sets , , and a set of bicubic spline coefficients . Following these are values for and the coordinates , for , and values for and the coordinates , for , defining the grid of points on which the spline is to be evaluated.
10.1
Program Text
10.2
Program Data
10.3
Program Results