NAG Library Function Document
nag_2d_spline_eval_rect (e02dfc)
1 Purpose
nag_2d_spline_eval_rect (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
#include <nag.h> |
#include <nage02.h> |
void |
nag_2d_spline_eval_rect (Integer mx,
Integer my,
const double x[],
const double y[],
double ff[],
Nag_2dSpline *spline,
NagError *fail) |
|
3 Description
nag_2d_spline_eval_rect (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
nag_2d_spline_interpolant (e01dac),
nag_2d_spline_fit_grid (e02dcc) and
nag_2d_spline_fit_scat (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:
– IntegerInput
- 2:
– IntegerInput
-
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 doubleInput
- 4:
– const doubleInput
-
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:
– doubleOutput
-
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 nag_2d_spline_eval_rect (e02dfc) follows a call to
nag_2d_spline_interpolant (e01dac),
nag_2d_spline_fit_grid (e02dcc) or
nag_2d_spline_fit_scat (e02ddc), in which case, members of the structure
spline will have been set up correctly for input to nag_2d_spline_eval_rect (e02dfc).
- 7:
– 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.
- 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
Not applicable.
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
Program Text (e02dfce.c)
10.2 Program Data
Program Data (e02dfce.d)
10.3 Program Results
Program Results (e02dfce.r)