NAG CL Interface
e02bdc computes the definite integral of a cubic spline from its B-spline representation.
The function may be called by the names: e02bdc, nag_fit_dim1_spline_integ or nag_1d_spline_intg.
computes the definite integral of the cubic spline
between the limits
are respectively the lower and upper limits of the range over which
is defined. It is assumed that
is represented in terms of its B-spline coefficients
and (augmented) ordered knot set
, (see e02bac
is the number of intervals of the spline and
denotes the normalized B-spline of degree
) defined upon the knots
The method employed uses the formula given in Section 3 of Cox (1975)
can be used to determine the definite integrals of cubic spline fits and interpolants produced by
Cox M G (1975) An algorithm for spline interpolation J. Inst. Math. Appl. 15 95–108
– Nag_Spline *
Pointer to structure of type Nag_Spline with the following members:
- n – IntegerInput
On entry: , where is the number of intervals of the spline (which is one greater than the number of interior knots, i.e., the knots strictly within the range to ) over which the spline is defined.
- lamda – double *Input
On entry: a pointer to which memory of size must be allocated. must be set to the value of the th member of the complete set of knots, for .
must be in nondecreasing order with
- c – double *Input
On entry: a pointer to which memory of size must be allocated. holds the coefficient of the B-spline , for .
– double *
On exit: the value of the definite integral of between the limits and , where and .
– NagError *
The NAG error argument (see Section 7
in the Introduction to the NAG Library CL Interface).
Error Indicators and Warnings
On entry, must not be less than 8: .
On entry, the knots must satisfy the following constraints:
, , for , with equality in the cases , , and .
The rounding errors are such that the computed value of the integral is exact for a slightly perturbed set of B-spline coefficients differing in a relative sense from those supplied by no more than .
Parallelism and Performance
Background information to multithreading can be found in the Multithreading
e02bdc is not threaded in any implementation.
Under normal usage, the call to e02bdc
will follow a call to e01bac
. In that case, the structure spline
will have been set up correctly for input to e02bdc
The time taken is approximately proportional to .
This example determines the definite integral over the interval of a cubic spline having interior knots at the positions , , , , , , the additional knots , , , , , , , , and the B-spline coefficients , , , , , , , , , .
The input data items (using the notation of Section 5
) comprise the following values in the order indicated:
The example program is written in a general form that will enable the definite integral of a cubic spline having an arbitrary number of knots to be computed. Any number of datasets may be supplied. The only changes required to the program relate to the size of
and the storage allocated to
within the structure spline