E02DEF (PDF version)
E02 Chapter Contents
E02 Chapter Introduction
NAG Library Manual

NAG Library Routine Document


Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

E02DEF calculates values of a bicubic spline from its B-spline representation.

2  Specification

REAL (KIND=nag_wp)  X(M), Y(M), LAMDA(PX), MU(PY), C((PX-4)*(PY-4)), FF(M), WRK(PY-4)

3  Description

E02DEF calculates values of the bicubic spline sx,y at prescribed points xr,yr, for r=1,2,,m, from its augmented knot sets λ and μ and from the coefficients cij, for i=1,2,,PX-4 and j=1,2,,PY-4, in its B-spline representation
Here Mix and Njy denote normalized cubic B-splines, the former defined on the knots λi to λi+4 and the latter on the knots μj to μj+4.
This routine may be used to calculate values of a bicubic spline given in the form produced by E01DAF, E02DAF, E02DCF and E02DDF. 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  Parameters

1:     M – INTEGERInput
On entry: m, the number of points at which values of the spline are required.
Constraint: M1.
2:     PX – INTEGERInput
3:     PY – INTEGERInput
On entry: PX and PY must specify the total number of knots associated with the variables x and y respectively. They are such that PX-8 and PY-8 are the corresponding numbers of interior knots.
Constraint: PX8 and PY8.
4:     X(M) – REAL (KIND=nag_wp) arrayInput
5:     Y(M) – REAL (KIND=nag_wp) arrayInput
On entry: X and Y must contain xr and yr, for r=1,2,,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: X and Y must satisfy
MU4YrMUPY- 3,   r= 1,2,,m.
The spline representation is not valid outside these intervals.
6:     LAMDA(PX) – REAL (KIND=nag_wp) arrayInput
7:     MU(PY) – REAL (KIND=nag_wp) arrayInput
On entry: LAMDA and MU must contain the complete sets of knots λ and μ associated with the x and y variables respectively.
Constraint: the knots in each set must be in nondecreasing order, with LAMDAPX-3>LAMDA4 and MUPY-3>MU4.
8:     C(PX-4×PY-4) – REAL (KIND=nag_wp) arrayInput
On entry: CPY-4×i-1+j must contain the coefficient cij described in Section 3, for i=1,2,,PX-4 and j=1,2,,PY-4.
9:     FF(M) – REAL (KIND=nag_wp) arrayOutput
On exit: FFr contains the value of the spline at the point xr,yr, for r=1,2,,m.
10:   WRK(PY-4) – REAL (KIND=nag_wp) arrayWorkspace
11:   IWRK(PY-4) – INTEGER arrayWorkspace
12:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
On entry,M<1,
On entry, the knots in array LAMDA, or those in array MU, are not in nondecreasing order, or LAMDAPX-3LAMDA4, or MUPY-3MU4.
On entry, at least one of the prescribed points xr,yr lies outside the rectangle defined by LAMDA4, LAMDAPX-3 and MU4, MUPY-3.

7  Accuracy

The method used to evaluate the B-splines is numerically stable, in the sense that each computed value of sxr,yr 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  Further Comments

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

9  Example

This program reads in knot sets LAMDA1,,LAMDAPX and MU1,,MUPY, and a set of bicubic spline coefficients cij. Following these are a value for m and the coordinates xr,yr, for r=1,2,,m, at which the spline is to be evaluated.

9.1  Program Text

Program Text (e02defe.f90)

9.2  Program Data

Program Data (e02defe.d)

9.3  Program Results

Program Results (e02defe.r)

Produced by GNUPLOT 4.4 patchlevel 0 1 1.2 1.4 1.6 1.8 2 0 0.2 0.4 0.6 0.8 1 1 1.5 2 2.5 3 3.5 4 4.5 5 Example Program Evaluation of Least-squares Bicubic Spline Fit at Scattered Points Evaluatuation points Bicubic Spline Surface x y

E02DEF (PDF version)
E02 Chapter Contents
E02 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012