hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_fit_2dspline_evalv (e02de)

Purpose

nag_fit_2dspline_evalv (e02de) calculates values of a bicubic spline from its B-spline representation.

Syntax

[ff, ifail] = e02de(x, y, lamda, mu, c, 'm', m, 'px', px, 'py', py)
[ff, ifail] = nag_fit_2dspline_evalv(x, y, lamda, mu, c, 'm', m, 'px', px, 'py', py)

Description

nag_fit_2dspline_evalv (e02de) calculates values of the bicubic spline s(x,y)s(x,y) at prescribed points (xr,yr)(xr,yr), for r = 1,2,,mr=1,2,,m, from its augmented knot sets {λ}{λ} and {μ}{μ} and from the coefficients cijcij, for i = 1,2,,px4i=1,2,,px-4 and j = 1,2,,py4j=1,2,,py-4, in its B-spline representation
s(x,y) =  cijMi(x)Nj(y).
ij
s(x,y)=ijcijMi(x)Nj(y).
Here Mi(x)Mi(x) and Nj(y)Nj(y) denote normalized cubic B-splines, the former defined on the knots λiλi to λi + 4λi+4 and the latter on the knots μjμj to μj + 4μj+4.
This function may be used to calculate values of a bicubic spline given in the form produced by nag_interp_2d_spline_grid (e01da), nag_fit_2dspline_panel (e02da), nag_fit_2dspline_grid (e02dc) and nag_fit_2dspline_sctr (e02dd). It is derived from the function B2VRE in Anthony et al. (1982).

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

Parameters

Compulsory Input Parameters

1:     x(m) – double array
2:     y(m) – double array
m, the dimension of the array, must satisfy the constraint m1m1.
x and y must contain xrxr and yryr, for r = 1,2,,mr=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: xx and yy must satisfy
lamda(4)x(r)lamda(px3)
lamda4xrlamdapx-3
and
mu(4)y(r)mu(py 3),   r = 1,2,,m.
mu4yrmupy- 3,   r= 1,2,,m.
.
The spline representation is not valid outside these intervals.
3:     lamda(px) – double array
4:     mu(py) – double array
px, the dimension of the array, must satisfy the constraint px8px8 and py8py8.
lamda and mu must contain the complete sets of knots {λ}{λ} and {μ}{μ} associated with the xx and yy variables respectively.
Constraint: the knots in each set must be in nondecreasing order, with lamda(px3) > lamda(4)lamdapx-3>lamda4 and mu(py3) > mu(4)mupy-3>mu4.
5:     c((px4) × (py4)(px-4)×(py-4)) – double array
c((py4) × (i1) + j)c((py-4)×(i-1)+j) must contain the coefficient cijcij described in Section [Description], for i = 1,2,,px4i=1,2,,px-4 and j = 1,2,,py4j=1,2,,py-4.

Optional Input Parameters

1:     m – int64int32nag_int scalar
Default: The dimension of the arrays x, y. (An error is raised if these dimensions are not equal.)
mm, the number of points at which values of the spline are required.
Constraint: m1m1.
2:     px – int64int32nag_int scalar
3:     py – int64int32nag_int scalar
Default: For px, the dimension of the array lamda. For py, the dimension of the array mu.
px and py must specify the total number of knots associated with the variables xx and yy respectively. They are such that px8px-8 and py8py-8 are the corresponding numbers of interior knots.
Constraint: px8px8 and py8py8.

Input Parameters Omitted from the MATLAB Interface

wrk iwrk

Output Parameters

1:     ff(m) – double array
ff(r)ffr contains the value of the spline at the point (xr,yr)(xr,yr), for r = 1,2,,mr=1,2,,m.
2:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,m < 1m<1,
orpy < 8py<8,
orpx < 8px<8.
  ifail = 2ifail=2
On entry, the knots in array lamda, or those in array mu, are not in nondecreasing order, or lamda(px3)lamda(4)lamdapx-3lamda4, or mu(py3)mu(4)mupy-3mu4.
  ifail = 3ifail=3
On entry, at least one of the prescribed points (xr,yr)(xr,yr) lies outside the rectangle defined by lamda(4)lamda4, lamda(px3)lamdapx-3 and mu(4)mu4, mu(py3)mupy-3.

Accuracy

The method used to evaluate the B-splines is numerically stable, in the sense that each computed value of s(xr,yr)s(xr,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.

Further Comments

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

Example

function nag_fit_2dspline_evalv_example
x = [1;
     1.1;
     1.5;
     1.6;
     1.9;
     1.9;
     2];
y = [0;
     0.1;
     0.7;
     0.4;
     0.3;
     0.8;
     1];
lamda = [1;
     1;
     1;
     1;
     1.3;
     1.5;
     1.6;
     2;
     2;
     2;
     2];
mu = [0;
     0;
     0;
     0;
     0.4;
     0.7;
     1;
     1;
     1;
     1];
c = [1;
     1.1333;
     1.3667;
     1.7;
     1.9;
     2;
     1.2;
     1.3333;
     1.5667;
     1.9;
     2.1;
     2.2;
     1.5833;
     1.7167;
     1.95;
     2.2833;
     2.4833;
     2.5833;
     2.1433;
     2.2767;
     2.51;
     2.8433;
     3.0433;
     3.1433;
     2.8667;
     3;
     3.2333;
     3.5667;
     3.7667;
     3.8667;
     3.4667;
     3.6;
     3.8333;
     4.1667;
     4.3667;
     4.4667;
     4;
     4.1333;
     4.3667;
     4.7;
     4.9;
     5];
[ff, ifail] = nag_fit_2dspline_evalv(x, y, lamda, mu, c)
 

ff =

    1.0000
    1.3100
    2.9500
    2.9600
    3.9100
    4.4100
    5.0000


ifail =

                    0


function e02de_example
x = [1;
     1.1;
     1.5;
     1.6;
     1.9;
     1.9;
     2];
y = [0;
     0.1;
     0.7;
     0.4;
     0.3;
     0.8;
     1];
lamda = [1;
     1;
     1;
     1;
     1.3;
     1.5;
     1.6;
     2;
     2;
     2;
     2];
mu = [0;
     0;
     0;
     0;
     0.4;
     0.7;
     1;
     1;
     1;
     1];
c = [1;
     1.1333;
     1.3667;
     1.7;
     1.9;
     2;
     1.2;
     1.3333;
     1.5667;
     1.9;
     2.1;
     2.2;
     1.5833;
     1.7167;
     1.95;
     2.2833;
     2.4833;
     2.5833;
     2.1433;
     2.2767;
     2.51;
     2.8433;
     3.0433;
     3.1433;
     2.8667;
     3;
     3.2333;
     3.5667;
     3.7667;
     3.8667;
     3.4667;
     3.6;
     3.8333;
     4.1667;
     4.3667;
     4.4667;
     4;
     4.1333;
     4.3667;
     4.7;
     4.9;
     5];
[ff, ifail] = e02de(x, y, lamda, mu, c)
 

ff =

    1.0000
    1.3100
    2.9500
    2.9600
    3.9100
    4.4100
    5.0000


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013