NAG CL Interface
e02bbc evaluates a cubic spline from its B-spline representation.
||e02bbc (double x,
The function may be called by the names: e02bbc, nag_fit_dim1_spline_eval or nag_1d_spline_evaluate.
evaluates the cubic spline
at a prescribed argument
from its augmented knot set
, (see e02bac
) and from the coefficients
, in its B-spline representation
is the number of intervals of the spline, and
denotes the normalized B-spline of degree 3 defined upon the knots
. The prescribed argument
It is assumed that , for , and .
The method employed is that of evaluation by taking convex combinations due to de Boor (1972)
. For further details of the algorithm and its use see Cox (1972)
and Cox (1978)
It is expected that a common use of e02bbc
will be the evaluation of the cubic spline approximations produced by e02bac
. A generalization of e02bbc
which also forms the derivative of
takes about 50% longer than e02bbc
Cox M G (1972) The numerical evaluation of B-splines J. Inst. Math. Appl. 10 134–149
Cox M G (1978) The numerical evaluation of a spline from its B-spline representation J. Inst. Math. Appl. 21 135–143
Cox M G and Hayes J G (1973) Curve fitting: a guide and suite of algorithms for the non-specialist user NPL Report NAC26 National Physical Laboratory
de Boor C (1972) On calculating with B-splines J. Approx. Theory 6 50–62
On entry: the argument at which the cubic spline is to be evaluated.
– double *
On exit: the value of the spline, .
– Nag_Spline *
Pointer to structure of type Nag_Spline with the following members:
- n – IntegerInput
On entry: , where is the number of intervals (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 .
the 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 .
Under normal usage, the call to e02bbc
will follow a call to e02bac
. In that case, the structure spline
will have been set up correctly for input to e02bbc
– NagError *
The NAG error argument (see Section 7
in the Introduction to the NAG Library CL Interface).
Error Indicators and Warnings
On entry, x
In this case s
is set arbitrarily to zero.
On entry, must not be less than 8: .
The computed value of
has negligible error in most practical situations. Specifically, this value has an absolute error bounded in modulus by machine precision
is the largest in modulus of
is an integer such that
are all of the same sign, then the computed value of
has a relative error not exceeding machine precision
in modulus. For further details see Cox (1978)
Parallelism and Performance
e02bbc is not threaded in any implementation.
The time taken by e02bbc is approximately C seconds, where C is a machine-dependent constant.
Note: the function does not test all the conditions on the knots given in the description of
in Section 5
, since to do this would result in a computation time approximately linear in
. All the conditions are tested in e02bac
, however, and the knots returned by e01bac
will satisfy the conditions.
Evaluate at 9 equally-spaced points in the interval the cubic spline with (augmented) knots , , , , , , , , , , 9.0 and normalized cubic B-spline coefficients , , , , , , 3.0.
The example program is written in a general form that will enable a cubic spline with intervals, in its normalized cubic B-spline form, to be evaluated at equally-spaced points in the interval . The program is self-starting in that any number of datasets may be supplied.