pchdoc.f 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. *DECK PCHDOC
  2. SUBROUTINE PCHDOC
  3. C***BEGIN PROLOGUE PCHDOC
  4. C***PURPOSE Documentation for PCHIP, a Fortran package for piecewise
  5. C cubic Hermite interpolation of data.
  6. C***LIBRARY SLATEC (PCHIP)
  7. C***CATEGORY E1A, Z
  8. C***TYPE ALL (PCHDOC-A)
  9. C***KEYWORDS CUBIC HERMITE INTERPOLATION, DOCUMENTATION,
  10. C MONOTONE INTERPOLATION, PCHIP,
  11. C PIECEWISE CUBIC INTERPOLATION
  12. C***AUTHOR Fritsch, F. N., (LLNL)
  13. C Lawrence Livermore National Laboratory
  14. C P.O. Box 808 (L-316)
  15. C Livermore, CA 94550
  16. C FTS 532-4275, (510) 422-4275
  17. C***DESCRIPTION
  18. C
  19. C PCHIP: Piecewise Cubic Hermite Interpolation Package
  20. C
  21. C This document describes the contents of PCHIP, which is a
  22. C Fortran package for piecewise cubic Hermite interpolation of data.
  23. C It features software to produce a monotone and "visually pleasing"
  24. C interpolant to monotone data. As is demonstrated in Reference 4,
  25. C such an interpolant may be more reasonable than a cubic spline if
  26. C the data contains both "steep" and "flat" sections. Interpola-
  27. C tion of cumulative probability distribution functions is another
  28. C application. (See References 2-4 for examples.)
  29. C
  30. C
  31. C All piecewise cubic functions in PCHIP are represented in
  32. C cubic Hermite form; that is, f(x) is determined by its values
  33. C F(I) and derivatives D(I) at the breakpoints X(I), I=1(1)N.
  34. C Throughout the package a PCH function is represented by the
  35. C five variables N, X, F, D, INCFD:
  36. C N - number of data points;
  37. C X - abscissa values for the data points;
  38. C F - ordinates (function values) for the data points;
  39. C D - slopes (derivative values) at the data points;
  40. C INCFD - increment between successive elements in the F- and
  41. C D-arrays (more on this later).
  42. C These appear together and in the same order in all calls.
  43. C
  44. C The double precision equivalents of the PCHIP routines are
  45. C obtained from the single precision names by prefixing the
  46. C single precision names with a D. For example, the double
  47. C precision equivalent of PCHIM is DPCHIM.
  48. C
  49. C The contents of the package are as follows:
  50. C
  51. C 1. Determine Derivative Values.
  52. C
  53. C NOTE: These routines provide alternate ways of determining D
  54. C if these values are not already known.
  55. C
  56. C PCHIM -- Piecewise Cubic Hermite Interpolation to Monotone
  57. C data.
  58. C Used if the data are monotonic or if the user wants
  59. C to guarantee that the interpolant stays within the
  60. C limits of the data. (See Reference 3.)
  61. C
  62. C PCHIC -- Piecewise Cubic Hermite Interpolation Coefficients.
  63. C Used if neither of the above conditions holds, or if
  64. C the user wishes control over boundary derivatives.
  65. C Will generally reproduce monotonicity on subintervals
  66. C over which the data are monotonic.
  67. C
  68. C PCHSP -- Piecewise Cubic Hermite Spline.
  69. C Produces a cubic spline interpolator in cubic Hermite
  70. C form. Provided primarily for easy comparison of the
  71. C spline with other piecewise cubic interpolants. (A
  72. C modified version of de Boor's CUBSPL, Reference 1.)
  73. C
  74. C 2. Evaluate, Differentiate, or Integrate Resulting PCH Function.
  75. C
  76. C NOTE: If derivative values are available from some other
  77. C source, these routines can be used without calling
  78. C any of the previous routines.
  79. C
  80. C CHFEV -- Cubic Hermite Function EValuator.
  81. C Evaluates a single cubic Hermite function at an array
  82. C of points. Used when the interval is known, as in
  83. C graphing applications. Called by PCHFE.
  84. C
  85. C PCHFE -- Piecewise Cubic Hermite Function Evaluator.
  86. C Used when the interval is unknown or the evaluation
  87. C array spans more than one data interval.
  88. C
  89. C CHFDV -- Cubic Hermite Function and Derivative Evaluator.
  90. C Evaluates a single cubic Hermite function and its
  91. C first derivative at an array of points. Used when
  92. C the interval is known, as in graphing applications.
  93. C Called by PCHFD.
  94. C
  95. C PCHFD -- Piecewise Cubic Hermite Function and Derivative
  96. C Evaluator.
  97. C Used when the interval is unknown or the evaluation
  98. C array spans more than one data interval.
  99. C
  100. C PCHID -- Piecewise Cubic Hermite Integrator, Data Limits.
  101. C Computes the definite integral of a piecewise cubic
  102. C Hermite function when the integration limits are data
  103. C points.
  104. C
  105. C PCHIA -- Piecewise Cubic Hermite Integrator, Arbitrary Limits.
  106. C Computes the definite integral of a piecewise cubic
  107. C Hermite function over an arbitrary finite interval.
  108. C
  109. C 3. Utility routines.
  110. C
  111. C PCHBS -- Piecewise Cubic Hermite to B-Spline converter.
  112. C Converts a PCH function to B-representation, so that
  113. C it can be used with other elements of the B-spline
  114. C package (see BSPDOC).
  115. C
  116. C PCHCM -- Piecewise Cubic Hermite, Check Monotonicity of.
  117. C Checks the monotonicity of an arbitrary PCH function.
  118. C Might be used with PCHSP to build a polyalgorithm for
  119. C piecewise C-2 interpolation.
  120. C
  121. C 4. Internal routines.
  122. C
  123. C CHFIE -- Cubic Hermite Function Integral Evaluator.
  124. C (Real function called by PCHIA.)
  125. C
  126. C CHFCM -- Cubic Hermite Function, Check Monotonicity of.
  127. C (Integer function called by PCHCM.)
  128. C
  129. C PCHCE -- PCHIC End Derivative Setter.
  130. C (Called by PCHIC.)
  131. C
  132. C PCHCI -- PCHIC Initial Derivative Setter.
  133. C (Called by PCHIC.)
  134. C
  135. C PCHCS -- PCHIC Monotonicity Switch Derivative Setter.
  136. C (Called by PCHIC.)
  137. C
  138. C PCHDF -- PCHIP Finite Difference Formula.
  139. C (Real function called by PCHCE and PCHSP.)
  140. C
  141. C PCHST -- PCHIP Sign Testing Routine.
  142. C (Real function called by various PCHIP routines.)
  143. C
  144. C PCHSW -- PCHCS Switch Excursion Adjuster.
  145. C (Called by PCHCS.)
  146. C
  147. C The calling sequences for these routines are described in the
  148. C prologues of the respective routines.
  149. C
  150. C
  151. C INCFD, the increment between successive elements in the F-
  152. C and D-arrays is included in the representation of a PCH function
  153. C in this package to facilitate two-dimensional applications. For
  154. C "normal" usage INCFD=1, and F and D are one-dimensional arrays.
  155. C one would call PCHxx (where "xx" is "IM", "IC", or "SP") with
  156. C
  157. C N, X, F, D, 1 .
  158. C
  159. C Suppose, however, that one has data on a rectangular mesh,
  160. C
  161. C F2D(I,J) = value at (X(I), Y(J)), I=1(1)NX,
  162. C J=1(1)NY.
  163. C Assume the following dimensions:
  164. C
  165. C REAL X(NXMAX), Y(NYMAX)
  166. C REAL F2D(NXMAX,NYMAX), FX(NXMAX,NYMAX), FY(NXMAX,NYMAX)
  167. C
  168. C where 2.LE.NX.LE.NXMAX AND 2.LE.NY.LE.NYMAX . To interpolate
  169. C in X along the line Y = Y(J), call PCHxx with
  170. C
  171. C NX, X, F2D(1,J), FX(1,J), 1 .
  172. C
  173. C To interpolate along the line X = X(I), call PCHxx with
  174. C
  175. C NY, Y, F2D(I,1), FY(I,1), NXMAX .
  176. C
  177. C (This example assumes the usual columnwise storage of 2-D arrays
  178. C in Fortran.)
  179. C
  180. C***REFERENCES 1. Carl de Boor, A Practical Guide to Splines, Springer-
  181. C Verlag, New York, 1978 (esp. Chapter IV, pp.49-62).
  182. C 2. F. N. Fritsch, Piecewise Cubic Hermite Interpolation
  183. C Package, Report UCRL-87285, Lawrence Livermore Natio-
  184. C nal Laboratory, July 1982. [Poster presented at the
  185. C SIAM 30th Anniversary Meeting, 19-23 July 1982.]
  186. C 3. F. N. Fritsch and J. Butland, A method for construc-
  187. C ting local monotone piecewise cubic interpolants, SIAM
  188. C Journal on Scientific and Statistical Computing 5, 2
  189. C (June 1984), pp. 300-304.
  190. C 4. F. N. Fritsch and R. E. Carlson, Monotone piecewise
  191. C cubic interpolation, SIAM Journal on Numerical Ana-
  192. C lysis 17, 2 (April 1980), pp. 238-246.
  193. C***ROUTINES CALLED (NONE)
  194. C***REVISION HISTORY (YYMMDD)
  195. C 811106 DATE WRITTEN
  196. C 870930 Updated Reference 3.
  197. C 890414 Changed PCHMC and CHFMC to PCHCM and CHFCM, respectively,
  198. C and augmented description of PCHCM.
  199. C 891214 Prologue converted to Version 4.0 format. (BAB)
  200. C 910826 1. Revised purpose, clarified role of argument INCFD,
  201. C corrected error in example, and removed redundant
  202. C reference list.
  203. C 2. Added description of PCHBS. (FNF)
  204. C 920429 Revised format and order of references. (WRB,FNF)
  205. C 930505 Changed CHFIV to CHFIE. (FNF)
  206. C***END PROLOGUE PCHDOC
  207. C-----------------------------------------------------------------------
  208. C THIS IS A DUMMY SUBROUTINE, AND SHOULD NEVER BE CALLED.
  209. C
  210. C***FIRST EXECUTABLE STATEMENT PCHDOC
  211. RETURN
  212. C------------- LAST LINE OF PCHDOC FOLLOWS -----------------------------
  213. END