NAG Library Routine Document

e02dff  (dim2_spline_evalm)

 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

Fortran Interface
Subroutine e02dff ( mx, my, px, py, x, y, lamda, mu, c, ff, wrk, lwrk, iwrk, liwrk, ifail)
Integer, Intent (In):: mx, my, px, py, lwrk, liwrk
Integer, Intent (Inout):: ifail
Integer, Intent (Out):: iwrk(liwrk)
Real (Kind=nag_wp), Intent (In):: x(mx), y(my), lamda(px), mu(py), c((px-4)*(py-4))
Real (Kind=nag_wp), Intent (Out):: ff(mx*my), wrk(lwrk)
C Header Interface
#include nagmk26.h
void  e02dff_ ( const Integer *mx, const Integer *my, const Integer *px, const Integer *py, const double x[], const double y[], const double lamda[], const double mu[], const double c[], double ff[], double wrk[], const Integer *lwrk, Integer iwrk[], const Integer *liwrk, Integer *ifail)

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
Arguments

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:     xmx – Real (Kind=nag_wp) arrayInput
6:     ymy – 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:     lamdapx – Real (Kind=nag_wp) arrayInput
8:     mupy – 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:     cpx-4×py-4 – Real (Kind=nag_wp) arrayInput
On entry: c py-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:   ffmx×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:   wrklwrk – 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:   iwrkliwrk – 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 argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation 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 argument, 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.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

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
Parallelism and Performance

e02dff is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9
Further Comments

Computation time is approximately proportional to mxmy+4mx+my.

10
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.

10.1
Program Text

Program Text (e02dffe.f90)

10.2
Program Data

Program Data (e02dffe.d)

10.3
Program Results

Program Results (e02dffe.r)

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