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

NAG Library Routine Document

E02DFF

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

E02DFF calculates values of a bicubic spline from its B-spline representation. The spline is evaluated at all points on a rectangular grid.

2  Specification

SUBROUTINE E02DFF ( MX, MY, PX, PY, X, Y, LAMDA, MU, C, FF, WRK, LWRK, IWRK, LIWRK, IFAIL)
INTEGER  MX, MY, PX, PY, LWRK, IWRK(LIWRK), LIWRK, IFAIL
REAL (KIND=nag_wp)  X(MX), Y(MY), LAMDA(PX), MU(PY), C((PX-4)*(PY-4)), FF(MX*MY), WRK(LWRK)

3  Description

E02DFF calculates values of the bicubic spline sx,y on a rectangular grid of points in the x-y plane, 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
sx,y = ij cij Mix Njy .
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.
The points in the grid are defined by coordinates xq, for q=1,2,,mx, along the x axis, and coordinates yr, for r=1,2,,my, along the y axis.
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:     MX – INTEGERInput
2:     MY – INTEGERInput
On entry: MX and MY must specify mx and my respectively, the number of points along the x and y axis that define the rectangular grid.
Constraint: MX1 and MY1.
3:     PX – INTEGERInput
4:     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.
5:     X(MX) – REAL (KIND=nag_wp) arrayInput
6:     Y(MY) – REAL (KIND=nag_wp) arrayInput
On entry: X and Y must contain xq, for q=1,2,,mx, and yr, for r=1,2,,my, respectively. These are the x and y coordinates that define the rectangular grid of points at which values of the spline are required.
Constraint: X and Y must satisfy
LAMDA4 Xq < Xq+1 LAMDAPX-3 ,   q=1,2,,mx-1
and
MU4 Yr < Yr+1 MUPY-3 ,   r= 1,2,,my- 1 .
.
The spline representation is not valid outside these intervals.
7:     LAMDA(PX) – REAL (KIND=nag_wp) arrayInput
8:     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.
9:     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.
10:   FF(MX×MY) – REAL (KIND=nag_wp) arrayOutput
On exit: FFMY×q-1+r contains the value of the spline at the point xq,yr, for q=1,2,,mx and r=1,2,,my.
11:   WRK(LWRK) – REAL (KIND=nag_wp) arrayWorkspace
12:   LWRK – INTEGERInput
On entry: the dimension of the array WRK as declared in the (sub)program from which E02DFF is called.
Constraint: LWRKmin4×MX+PX,4×MY+PY.
13:   IWRK(LIWRK) – INTEGER arrayWorkspace
14:   LIWRK – INTEGERInput
On entry: the dimension of the array IWRK as declared in the (sub)program from which E02DFF is called.
Constraints:
  • if 4×MX+PX>4×MY+PY, LIWRKMY+PY-4;
  • otherwise LIWRKMX+PX-4.
15:   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:
IFAIL=1
On entry,MX<1,
orMY<1,
orPY<8,
orPX<8.
IFAIL=2
On entry,LWRK is too small,
orLIWRK is too small.
IFAIL=3
On entry, the knots in array LAMDA, or those in array MU, are not in nondecreasing order, or LAMDAPX-3LAMDA4, or MUPY-3MU4.
IFAIL=4
On entry, the restriction LAMDA4X1<<XMXLAMDAPX-3, or the restriction MU4Y1<<YMYMUPY-3, is violated.

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 mxmy+4mx+my.

9  Example

This example reads in knot sets LAMDA1,,LAMDAPX and MU1,,MUPY, and a set of bicubic spline coefficients cij. Following these are values for mx and the x coordinates xq, for q=1,2,,mx, and values for my and the y coordinates yr, for r=1,2,,my, defining the grid of points on which the spline is to be evaluated.

9.1  Program Text

Program Text (e02dffe.f90)

9.2  Program Data

Program Data (e02dffe.d)

9.3  Program Results

Program Results (e02dffe.r)


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

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