PCHFD(3)

SYNOPSIS
SUBROUTINE PCHFD (N, X, F, D, INCFD, SKIP, NE, XE, FE, DE, IERR)

NAME
pchfd - Evaluate a piecewise cubic Hermite function and its first derivative at an array of points. May be used by itself for Hermite interpolation, or as an evaluator for PCHIM or PCHIC. If only function values are required, use PCHFE instead.

LIBRARY
SLATEC (PCHIP)

CATEGORY
E3, H1

TYPE
SINGLE PRECISION (PCHFD-S, DPCHFD-D)

KEYWORDS
CUBIC HERMITE DIFFERENTIATION, CUBIC HERMITE EVALUATION, HERMITE INTERPOLATION, PCHIP, PIECEWISE CUBIC EVALUATION

AUTHOR
Fritsch, F. N., (LLNL) Lawrence Livermore National Laboratory P.O. Box 808 (L-316) Livermore, CA 94550 FTS 532-4275, (510) 422-4275

DESCRIPTION
PCHFD: Piecewise Cubic Hermite Function and Derivative evaluator Evaluates the cubic Hermite function defined by N, X, F, D, to- gether with its first derivative, at the points XE(J), J=1(1)NE. If only function values are required, use PCHFE, instead. To provide compatibility with PCHIM and PCHIC, includes an increment between successive values of the F- and D-arrays. ---------------------------------------------------------------------- Calling sequence: PARAMETER (INCFD = ...) INTEGER N, NE, IERR REAL X(N), F(INCFD,N), D(INCFD,N), XE(NE), FE(NE), DE(NE) LOGICAL SKIP CALL PCHFD (N, X, F, D, INCFD, SKIP, NE, XE, FE, DE, IERR) Parameters: N -- (input) number of data points. (Error return if N.LT.2 .) X -- (input) real array of independent variable values. The elements of X must be strictly increasing: X(I-1) .LT. X(I), I = 2(1)N. (Error return if not.) F -- (input) real array of function values. F(1+(I-1)*INCFD) is the value corresponding to X(I). D -- (input) real array of derivative values. D(1+(I-1)*INCFD) is the value corresponding to X(I). INCFD -- (input) increment between successive values in F and D. (Error return if INCFD.LT.1 .) SKIP -- (input/output) logical variable which should be set to preceding parameters, or to .FALSE. otherwise. This will save time in case these checks have already been performed (say, in PCHIM or PCHIC). SKIP will be set to .TRUE. on normal return. NE -- (input) number of evaluation points. (Error return if NE.LT.1 .) XE -- (input) real array of points at which the functions are to be evaluated. NOTES: 1. The evaluation will be most efficient if the elements of XE are increasing relative to X; that is, XE(J) .GE. X(I) implies XE(K) .GE. X(I), all K.GE.J . 2. If any of the XE are outside the interval [X(1),X(N)], values are extrapolated from the nearest extreme cubic, and a warning error is returned. FE -- (output) real array of values of the cubic Hermite function defined by N, X, F, D at the points XE. DE -- (output) real array of values of the first derivative of the same function at the points XE. IERR -- (output) error flag. Normal return: IERR = 0 (no errors). Warning error: IERR.GT.0 means that extrapolation was performed at IERR points. "Recoverable" errors: IERR = -1 if N.LT.2 . IERR = -2 if INCFD.LT.1 . IERR = -3 if the X-array is not strictly increasing. IERR = -4 if NE.LT.1 . (Output arrays have not been changed in any of these cases.) NOTE: The above errors are checked in the order listed, and following arguments have **NOT** been validated. IERR = -5 if an error has occurred in the lower-level routine CHFDV. NB: this should never happen. Notify the author **IMMEDIATELY** if it does.

REFERENCES
(NONE)

ROUTINES CALLED
CHFDV, XERMSG

REVISION HISTORY (YYMMDD)
811020 DATE WRITTEN
820803 Minor cosmetic changes for release 1.
870707 Minor cosmetic changes to prologue.
890531 Changed all specific intrinsics to generic. (WRB)
890831 Modified array declarations. (WRB)
890831 REVISION DATE from Version 3.2
891214 Prologue converted to Version 4.0 format. (BAB)
900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)