The function may be called by the names: e02bbc, nag_fit_dim1_spline_eval or nag_1d_spline_evaluate.
3Description
e02bbc evaluates the cubic spline at a prescribed argument from its augmented knot set , for , (see e02bac) and from the coefficients , for , in its B-spline representation
Here , where is the number of intervals of the spline, and denotes the normalized B-spline of degree 3 defined upon the knots . The prescribed argument must satisfy .
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 is e02bcc. e02bcc takes about 50% longer than e02bbc.
4References
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. Theory6 50–62
5Arguments
1: – doubleInput
On entry: the argument at which the cubic spline is to be evaluated.
Constraint:
.
2: – double *Output
On exit: the value of the spline, .
3: – 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.
Constraint:
.
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 .
Constraint:
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, e01bac or e02bec. In that case, the structure spline will have been set up correctly for input to e02bbc.
4: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
6Error Indicators and Warnings
NE_ABSCI_OUTSIDE_KNOT_INTVL
On entry, x must satisfy :
, , .
In this case s is set arbitrarily to zero.
NE_INT_ARG_LT
On entry, must not be less than 8: .
7Accuracy
The computed value of has negligible error in most practical situations. Specifically, this value has an absolute error bounded in modulus by machine precision, where is the largest in modulus of and , and is an integer such that . If and 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).
8Parallelism and Performance
e02bbc is not threaded in any implementation.
9Further Comments
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 instead of . All the conditions are tested in e02bac, however, and the knots returned by e01bac or e02bec will satisfy the conditions.
10Example
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.