NAG C Library Function Document
nag_2d_spline_deriv_rect (e02dhc)
1
Purpose
nag_2d_spline_deriv_rect (e02dhc) computes the partial derivative (of order
,
), of a bicubic spline approximation to a set of data values, from its B-spline representation, at points on a rectangular grid in the
-
plane. This function may be used to calculate derivatives of a bicubic spline given in the form produced by
nag_2d_spline_interpolant (e01dac),
nag_2d_spline_fit_panel (e02dac),
nag_2d_spline_fit_grid (e02dcc) and
nag_2d_spline_fit_scat (e02ddc).
2
Specification
#include <nag.h> |
#include <nage02.h> |
void |
nag_2d_spline_deriv_rect (Integer mx,
Integer my,
const double x[],
const double y[],
Integer nux,
Integer nuy,
double z[],
Nag_2dSpline *spline,
NagError *fail) |
|
3
Description
nag_2d_spline_deriv_rect (e02dhc) determines the partial derivative of a smooth bicubic spline approximation at the set of data points .
The spline is given in the B-spline representation
where
and
denote normalized cubic B-splines, the former defined on the knots
to
and the latter on the knots
to
, with
and
the total numbers of knots of the computed spline with respect to the
and
variables respectively. For further details, see
Hayes and Halliday (1974) for bicubic splines and
de Boor (1972) for normalized B-splines. This function is suitable for B-spline representations returned by
nag_2d_spline_interpolant (e01dac),
nag_2d_spline_fit_panel (e02dac),
nag_2d_spline_fit_grid (e02dcc) and
nag_2d_spline_fit_scat (e02ddc).
The partial derivatives can be up to order in each direction; thus the highest mixed derivative available is .
The points in the grid are defined by coordinates , for , along the axis, and coordinates , for , along the axis.
4
References
de Boor C (1972) On calculating with B-splines J. Approx. Theory 6 50–62
Dierckx P (1981) An improved algorithm for curve fitting with spline functions Report TW54 Department of Computer Science, Katholieke Univerciteit Leuven
Dierckx P (1982) A fast algorithm for smoothing data on a rectangular grid while using spline functions SIAM J. Numer. Anal. 19 1286–1304
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
Reinsch C H (1967) Smoothing by spline functions Numer. Math. 10 177–183
5
Arguments
- 1:
– IntegerInput
-
On entry: , the number of grid points along the axis.
Constraint:
.
- 2:
– IntegerInput
-
On entry: , the number of grid points along the axis.
Constraint:
.
- 3:
– const doubleInput
-
On entry: must be set to
, the coordinate of the th grid point along the axis, for , on which values of the partial derivative are sought.
Constraint:
.
- 4:
– const doubleInput
-
On entry: must be set to , the coordinate of the th grid point along the axis, for on which values of the partial derivative are sought.
Constraint:
.
- 5:
– IntegerInput
-
On entry: specifies the order, of the partial derivative in the -direction.
Constraint:
.
- 6:
– IntegerInput
-
On entry: specifies the order, of the partial derivative in the -direction.
Constraint:
.
- 7:
– doubleOutput
-
On exit: contains the derivative , for and .
- 8:
– Nag_2dSpline *Input
-
Pointer to structure of type Nag_2dSpline describing the bicubic spline approximation to be differentiated.
In normal usage, the call to
nag_2d_spline_deriv_rect (e02dhc) follows a call to
nag_2d_spline_interpolant (e01dac),
nag_2d_spline_fit_panel (e02dac),
nag_2d_spline_fit_grid (e02dcc) or
nag_2d_spline_fit_scat (e02ddc), in which case, members of the structure
spline will have been set up correctly for input to
nag_2d_spline_deriv_rect (e02dhc).
- 9:
– NagError *Input/Output
-
The NAG error argument (see
Section 3.7 in How to Use the NAG Library and its Documentation).
6
Error Indicators and Warnings
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_INT
-
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
- NE_INTERNAL_ERROR
-
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact
NAG for assistance.
See
Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
- NE_NO_LICENCE
-
Your licence key may have expired or may not have been installed correctly.
See
Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
- NE_NOT_STRICTLY_INCREASING
-
On entry, for , and .
Constraint: , for .
On entry, for , and .
Constraint: , for .
7
Accuracy
On successful exit, the partial derivatives on the given mesh are accurate to
machine precision with respect to the supplied bicubic spline. Please refer to Section 7 in
nag_2d_spline_interpolant (e01dac),
nag_2d_spline_fit_panel (e02dac),
nag_2d_spline_fit_grid (e02dcc) and
nag_2d_spline_fit_scat (e02ddc) of the function document for the respective function which calculated the spline approximant for details on the accuracy of that approximation.
8
Parallelism and Performance
nag_2d_spline_deriv_rect (e02dhc) makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the
x06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
None.
10
Example
This example reads in values of
,
,
, for
, and
, for
, followed by values of the ordinates
defined at the grid points
. It then calls
nag_2d_spline_fit_grid (e02dcc) to compute a bicubic spline approximation for one specified value of
. Finally it evaluates the spline and its first
derivative at a small sample of points on a rectangular grid by calling
nag_2d_spline_deriv_rect (e02dhc).
10.1
Program Text
Program Text (e02dhce.c)
10.2
Program Data
Program Data (e02dhce.d)
10.3
Program Results
Program Results (e02dhce.r)