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_sort (e02za)

Purpose

nag_fit_2dspline_sort (e02za) sorts two-dimensional data into rectangular panels.

Syntax

[point, ifail] = e02za(lamda, mu, x, y, 'px', px, 'py', py, 'm', m)
[point, ifail] = nag_fit_2dspline_sort(lamda, mu, x, y, 'px', px, 'py', py, 'm', m)

Description

A set of mm data points with rectangular Cartesian coordinates xr,yrxr,yr are sorted into panels defined by lines parallel to the yy and xx axes. The intercepts of these lines on the xx and yy axes are given in lamda(i)lamdai, for i = 5,6,,px4i=5,6,,px-4 and mu(j)muj, for j = 5,6,,py4j=5,6,,py-4, respectively. The function orders the data so that all points in a panel occur before data in succeeding panels, where the panels are numbered from bottom to top and then left to right, with the usual arrangement of axes, as shown in the diagram. Within a panel the points maintain their original order.
Figure 1
Figure 1
A data point lying exactly on one or more panel sides is taken to be in the highest-numbered panel adjacent to the point. The function does not physically rearrange the data, but provides the array point which contains a linked list for each panel, pointing to the data in that panel. The total number of panels is (px7) × (py7)(px-7)×(py-7).

References

None.

Parameters

Compulsory Input Parameters

1:     lamda(px) – double array
px, the dimension of the array, must satisfy the constraint px8px8 and py8py8.
lamda(5)lamda5 to lamda(px4)lamdapx-4 must contain, in nondecreasing order, the intercepts on the xx axis of the sides of the panels parallel to the yy axis.
2:     mu(py) – double array
py, the dimension of the array, must satisfy the constraint px8px8 and py8py8.
mu(5)mu5 to mu(py4)mupy-4 must contain, in nondecreasing order, the intercepts on the yy axis of the sides of the panels parallel to the xx axis.
3:     x(m) – double array
4:     y(m) – double array
The coordinates of the rrth data point (xr,yr)(xr,yr), for r = 1,2,,mr=1,2,,m.

Optional Input Parameters

1:     px – int64int32nag_int scalar
2:     py – int64int32nag_int scalar
Default: The dimension of the arrays lamda, mu. (An error is raised if these dimensions are not equal.)
px and py must specify eight more than the number of intercepts on the xx axis and yy axis, respectively.
Constraint: px8px8 and py8py8.
3:     m – int64int32nag_int scalar
Default: The dimension of the arrays x, y. (An error is raised if these dimensions are not equal.)
The number mm of data points.

Input Parameters Omitted from the MATLAB Interface

npoint adres nadres

Output Parameters

1:     point(npoint) – int64int32nag_int array
npointm + (px7) × (py7)npointm+(px-7)×(py-7).
For i = 1,2,,npointi=1,2,,npoint, point(m + i) = I1pointm+i=I1 is the index of the first point in panel ii, point(I1) = I2pointI1=I2 is the index of the second point in panel ii and so on.
point(In) = 0pointIn=0 indicates that x(In),y(In)xIn,yIn was the last point in the panel.
The coordinates of points in panel ii can be accessed in turn by means of the following instructions:
 in = point(m+i); while (in ~= 0) xi = x(in); yi = y(in); . . . in = point(in); end ... 
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
The intercepts in the array lamda, or in the array mu, are not in nondecreasing order.
  ifail = 2ifail=2
On entry,px < 8px<8,
orpy < 8py<8,
orm0m0,
ornadres(px7) × (py7)nadres(px-7)×(py-7),
ornpoint < m + (px7) × (py7)npoint<m+(px-7)×(py-7).

Accuracy

Not applicable.

Further Comments

The time taken is approximately proportional to m × log(npoint)m×log(npoint).
This function was written to sort two-dimensional data in the manner required by function nag_fit_2dspline_panel (e02da). The first 99 parameters of nag_fit_2dspline_sort (e02za) are the same as the parameters in nag_fit_2dspline_panel (e02da) which have the same name.

Example

function nag_fit_2dspline_sort_example
lamda = [0;
     0;
     0;
     0;
     1;
     0;
     0;
     0;
     0];
mu = [0;
     0;
     0;
     0;
     0.8;
     1.2;
     0;
     0;
     0;
     0];
x = [0;
     0.7;
     1.44;
     0.21;
     1.01;
     1.84;
     0.71;
     1;
     0.54;
     1.53];
y = [0.77;
     1.06;
     0.33;
     0.44;
     0.5;
     0.02;
     1.95;
     1.2;
     0.04;
     0.18];
[point, ifail] = nag_fit_2dspline_sort(lamda, mu, x, y)
 

point =

                    4
                    0
                    5
                    9
                    6
                   10
                    0
                    0
                    0
                    0
                    1
                    2
                    7
                    3
                    0
                    8


ifail =

                    0


function e02za_example
lamda = [0;
     0;
     0;
     0;
     1;
     0;
     0;
     0;
     0];
mu = [0;
     0;
     0;
     0;
     0.8;
     1.2;
     0;
     0;
     0;
     0];
x = [0;
     0.7;
     1.44;
     0.21;
     1.01;
     1.84;
     0.71;
     1;
     0.54;
     1.53];
y = [0.77;
     1.06;
     0.33;
     0.44;
     0.5;
     0.02;
     1.95;
     1.2;
     0.04;
     0.18];
[point, ifail] = e02za(lamda, mu, x, y)
 

point =

                    4
                    0
                    5
                    9
                    6
                   10
                    0
                    0
                    0
                    0
                    1
                    2
                    7
                    3
                    0
                    8


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