NAG CL Interface
e01bec computes a monotonicity-preserving piecewise cubic Hermite interpolant to a set of data points.
||e01bec (Integer n,
const double x,
const double f,
The function may be called by the names: e01bec, nag_interp_dim1_monotonic or nag_monotonic_interpolant.
estimates first derivatives at the set of data points
, which determine a piecewise cubic Hermite interpolant to the data, that preserves monotonicity over ranges where the data points are monotonic. If the data points are only piecewise monotonic, the interpolant will have an extremum at each point where monotonicity switches direction. The estimates of the derivatives are computed by a formula due to Brodlie, which is described in Fritsch and Butland (1984)
, with suitable changes at the boundary points.
The algorithm is derived from routine PCHIM in Fritsch (1982)
Values of the computed interpolant can subsequently be computed by calling e01bfc
Fritsch F N (1982) PCHIP final specifications Report UCID-30194 Lawrence Livermore National Laboratory
Fritsch F N and Butland J (1984) A method for constructing local monotone piecewise cubic interpolants SIAM J. Sci. Statist. Comput. 5 300–304
On entry: , the number of data points.
– const double
On entry: must be set to , the th value of the independent variable (abscissa), for .
– const double
On entry: must be set to , the th value of the dependent variable (ordinate), for .
On exit: estimates of derivatives at the data points. contains the derivative at .
– NagError *
The NAG error argument (see Section 7
in the Introduction to the NAG Library CL Interface).
Error Indicators and Warnings
On entry, .
On entry, for : , .
The values of , for , are not in strictly increasing order.
The computational errors in the array d
should be negligible in most practical situations.
Parallelism and Performance
e01bec is not threaded in any implementation.
The time taken by e01bec is approximately proportional to .
The values of the computed interpolant at the points
, may be obtained in the real array pf
, of length at least
, by the call:
e01bfc (n, x, f, d, m, px, pf, &fail)
are the input arguments to e01bec
is the output argument from e01bec
This example program reads in a set of data points, calls e01bec
to compute a piecewise monotonic interpolant, and then calls e01bfc
to evaluate the interpolant at equally spaced points.