The routine may be called by the names e01bef or nagf_interp_dim1_monotonic.
3Description
e01bef estimates first derivatives at the set of data points , for , 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 routine is derived from routine PCHIM in Fritsch (1982).
Values of the computed interpolant, and of its first derivative and definite integral, can subsequently be computed by calling e01bff,e01bgfande01bhf, as described in
Section 9.
4References
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
5Arguments
1: – IntegerInput
On entry: , the number of data points.
Constraint:
.
2: – Real (Kind=nag_wp) arrayInput
On entry: must be set to , the th value of the independent variable (abscissa), for .
Constraint:
.
3: – Real (Kind=nag_wp) arrayInput
On entry: must be set to , the th value of the dependent variable (ordinate), for .
4: – Real (Kind=nag_wp) arrayOutput
On exit: estimates of derivatives at the data points. contains the derivative at .
5: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, .
Constraint: .
On entry, , and .
Constraint: for all .
An unexpected error has been triggered by this routine. Please
contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
7Accuracy
The computational errors in the array d should be negligible in most practical situations.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
e01bef is not threaded in any implementation.
9Further Comments
The time taken by e01bef is approximately proportional to .
The values of the computed interpolant at the points , for , may be obtained
in the real array pf, of length at least m, by the call:
Call e01bff(n,x,f,d,m,px,pf,ifail)
where n, x and f are the input arguments to e01bef and
d is the output argument from e01bef.
The values of the computed interpolant at the points , for , together with its first derivatives, may be obtained
in the real arrays pf and pd, both of length at least m, by the call:
This example reads in a set of data points, calls
e01bef to compute a piecewise monotonic interpolant,
and then calls e01bff to evaluate the interpolant at equally spaced points.