NAG Library Routine Document
E01BFF evaluates a piecewise cubic Hermite interpolant at a set of points.
||N, M, IFAIL
||X(N), F(N), D(N), PX(M), PF(M)
E01BFF evaluates a piecewise cubic Hermite interpolant, as computed by E01BEF
, at the points
. If any point lies outside the interval from
, a value is extrapolated from the nearest extreme cubic, and a warning is returned.
The routine is derived from routine PCHFE in Fritsch (1982)
Fritsch F N (1982) PCHIP final specifications Report UCID-30194 Lawrence Livermore National Laboratory
- 1: N – INTEGERInput
- 2: X(N) – REAL (KIND=nag_wp) arrayInput
- 3: F(N) – REAL (KIND=nag_wp) arrayInput
- 4: D(N) – REAL (KIND=nag_wp) arrayInput
must be unchanged from the previous call of E01BEF
- 5: M – INTEGERInput
On entry: , the number of points at which the interpolant is to be evaluated.
- 6: PX(M) – REAL (KIND=nag_wp) arrayInput
On entry: the values of at which the interpolant is to be evaluated.
- 7: PF(M) – REAL (KIND=nag_wp) arrayOutput
On exit: contains the value of the interpolant evaluated at the point , for .
- 8: IFAIL – INTEGERInput/Output
must be set to
. If you are unfamiliar with this parameter you should refer to Section 3.3
in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
. When the value is used it is essential to test the value of IFAIL on exit.
unless the routine detects an error or a warning has been flagged (see Section 6
6 Error Indicators and Warnings
If on entry
, explanatory error messages are output on the current error message unit (as defined by X04AAF
Errors or warnings detected by the routine:
The values of , for , are not in strictly increasing order.
At least one of the points , for , lies outside the interval , and extrapolation was performed at all such points. Values computed at such points may be very unreliable.
The computational errors in the array PF
should be negligible in most practical situations.
The time taken by E01BFF is approximately proportional to the number of evaluation points,
. The evaluation will be most efficient if the elements of PX
are in nondecreasing order (or,
more generally, if they are grouped in increasing order of the intervals
). A single call of
is more efficient than several calls with
This example reads in values of N
, and then calls
E01BFF to evaluate the interpolant at equally spaced points.
9.1 Program Text
Program Text (e01bffe.f90)
9.2 Program Data
Program Data (e01bffe.d)
9.3 Program Results
Program Results (e01bffe.r)