e01da computes a bicubic spline interpolating surface through a set of data values, given on a rectangular grid in the - plane.
Syntax
C# |
---|
public static void e01da( int mx, int my, double[] x, double[] y, double[] f, out int px, out int py, double[] lamda, double[] mu, double[] c, out int ifail ) |
Visual Basic |
---|
Public Shared Sub e01da ( _ mx As Integer, _ my As Integer, _ x As Double(), _ y As Double(), _ f As Double(), _ <OutAttribute> ByRef px As Integer, _ <OutAttribute> ByRef py As Integer, _ lamda As Double(), _ mu As Double(), _ c As Double(), _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void e01da( int mx, int my, array<double>^ x, array<double>^ y, array<double>^ f, [OutAttribute] int% px, [OutAttribute] int% py, array<double>^ lamda, array<double>^ mu, array<double>^ c, [OutAttribute] int% ifail ) |
F# |
---|
static member e01da : mx : int * my : int * x : float[] * y : float[] * f : float[] * px : int byref * py : int byref * lamda : float[] * mu : float[] * c : float[] * ifail : int byref -> unit |
Parameters
- mx
- Type: System..::..Int32On entry: mx and my must specify and respectively, the number of points along the and axis that define the rectangular grid.Constraint: and .
- my
- Type: System..::..Int32On entry: mx and my must specify and respectively, the number of points along the and axis that define the rectangular grid.Constraint: and .
- x
- Type: array<System..::..Double>[]()[][]An array of size [mx]On entry: and must contain , for , and , for , respectively.Constraints:
- , for ;
- , for .
- y
- Type: array<System..::..Double>[]()[][]An array of size [mx]On entry: and must contain , for , and , for , respectively.Constraints:
- , for ;
- , for .
- f
- Type: array<System..::..Double>[]()[][]An array of size []On entry: must contain , for and .
- px
- Type: System..::..Int32%
- py
- Type: System..::..Int32%
- lamda
- Type: array<System..::..Double>[]()[][]An array of size []On exit: lamda contains the complete set of knots associated with the variable, i.e., the interior knots , as well as the additional knotsandneeded for the B-spline representation.
- mu
- Type: array<System..::..Double>[]()[][]An array of size []On exit: lamda contains the complete set of knots associated with the variable, i.e., the interior knots , as well as the additional knotsandneeded for the B-spline representation.
- c
- Type: array<System..::..Double>[]()[][]An array of size []On exit: the coefficients of the spline interpolant. contains the coefficient described in [Description].
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
e01da determines a bicubic spline interpolant to the set of data points
, for and . The spline is given in the B-spline representation
such that
where and denote normalized cubic B-splines, the former defined on the knots to and the latter on the knots to , and the are the spline coefficients. These knots, as well as the coefficients, are determined by the method, which is derived from the method B2IRE in Anthony et al. (1982). The method used is described in [Outline of Method Used].
For further information on splines, see Hayes and Halliday (1974) for bicubic splines and de Boor (1972) for normalized B-splines.
Values and derivatives of the computed spline can subsequently be computed by calling e02de e02df (E02DHF not in this release) as described in [Evaluation of Computed Spline].
References
Anthony G T, Cox M G and Hayes J G (1982) DASL – Data Approximation Subroutine Library National Physical Laboratory
Cox M G (1975) An algorithm for spline interpolation J. Inst. Math. Appl. 15 95–108
de Boor C (1972) On calculating with B-splines J. Approx. Theory 6 50–62
Hayes J G and Halliday J (1974) The least squares fitting of cubic spline surfaces to general data sets J. Inst. Math. Appl. 14 89–103
Error Indicators and Warnings
Errors or warnings detected by the method:
On entry, , or .
- A system of linear equations defining the B-spline coefficients was singular; the problem is too ill-conditioned to permit solution.
Accuracy
The main sources of rounding errors are in steps , , and of the algorithm described in [Outline of Method Used]. It can be shown (see Cox (1975)) that the matrix formed in step has elements differing relatively from their true values by at most a small multiple of , where is the machine precision. is ‘totally positive’, and a linear system with such a coefficient matrix can be solved quite safely by elimination without pivoting. Similar comments apply to steps and . Thus the complete process is numerically stable.
Parallelism and Performance
None.
Further Comments
Timing
The time taken by e01da is approximately proportional to .
Outline of Method Used
The process of computing the spline consists of the following steps:
1. | choice of the interior -knots , as , for , | ||
2. | formation of the system
|
||
3. | use of Gaussian elimination to reduce this system to band triangular form, | ||
4. | solution of this triangular system for , | ||
5. | choice of the interior knots , as , for , | ||
6. | formation of the system
|
||
7. | use of Gaussian elimination to reduce this system to band triangular form, | ||
8. | solution of this triangular system for and hence . |
For computational convenience, steps and , and likewise steps and , are combined so that the formation of and and the reductions to triangular form are carried out one row at a time.
Evaluation of Computed Spline
The values of the computed spline at the points , for , may be obtained in the real array ff (see e02de), of length at least , by the following call:
where and the coordinates , are stored in , .
PX and PY,
LAMDA, MU and C have the same values as
px and py
lamda, mu and c output from e01da.
WRK is a real workspace array of length at least PY, and IWRK is an integer workspace array of length at least .
(See e02de.)
To evaluate the computed spline on an by rectangular grid of points in the - plane, which is defined by the coordinates stored in , for , and the coordinates stored in , for , returning the results in the real array ff (see e02df) which is of length at least , the following call may be used:
where , .
PX and PY,
LAMDA, MU and C have the same values as
px, py,
lamda, mu and c output from e01da.
WRK is a real workspace array of length at least , for , , and IWRK is an integer workspace array of length at least if , or otherwise.
The result of the spline evaluated at grid point is returned in element () of the array FG.
Example
This example reads in values of , , for , and , for , followed by values of the ordinates defined at the grid points .
It then calls e01da to compute a bicubic spline interpolant of the data values, and prints the values of the knots and B-spline coefficients. Finally it evaluates the spline at a small sample of points on a rectangular grid.
Example program (C#): e01dae.cs