ppval.f 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. *DECK PPVAL
  2. FUNCTION PPVAL (LDC, C, XI, LXI, K, IDERIV, X, INPPV)
  3. C***BEGIN PROLOGUE PPVAL
  4. C***PURPOSE Calculate the value of the IDERIV-th derivative of the
  5. C B-spline from the PP-representation.
  6. C***LIBRARY SLATEC
  7. C***CATEGORY E3, K6
  8. C***TYPE SINGLE PRECISION (PPVAL-S, DPPVAL-D)
  9. C***KEYWORDS B-SPLINE, DATA FITTING, INTERPOLATION, SPLINES
  10. C***AUTHOR Amos, D. E., (SNLA)
  11. C***DESCRIPTION
  12. C
  13. C Written by Carl de Boor and modified by D. E. Amos
  14. C
  15. C Abstract
  16. C PPVAL is the PPVALU function of the reference.
  17. C
  18. C PPVAL calculates (at X) the value of the IDERIV-th
  19. C derivative of the B-spline from the PP-representation
  20. C (C,XI,LXI,K). The Taylor expansion about XI(J) for X in
  21. C the interval XI(J) .LE. X .LT. XI(J+1) is evaluated, J=1,LXI.
  22. C Right limiting values at X=XI(J) are obtained. PPVAL will
  23. C extrapolate beyond XI(1) and XI(LXI+1).
  24. C
  25. C To obtain left limiting values (left derivatives) at XI(J),
  26. C replace LXI by J-1 and set X=XI(J),J=2,LXI+1.
  27. C
  28. C Description of Arguments
  29. C Input
  30. C LDC - leading dimension of C matrix, LDC .GE. K
  31. C C - matrix of dimension at least (K,LXI) containing
  32. C right derivatives at break points XI(*).
  33. C XI - break point vector of length LXI+1
  34. C LXI - number of polynomial pieces
  35. C K - order of B-spline, K .GE. 1
  36. C IDERIV - order of the derivative, 0 .LE. IDERIV .LE. K-1
  37. C IDERIV=0 gives the B-spline value
  38. C X - argument, XI(1) .LE. X .LE. XI(LXI+1)
  39. C INPPV - an initialization parameter which must be set
  40. C to 1 the first time PPVAL is called.
  41. C
  42. C Output
  43. C INPPV - INPPV contains information for efficient process-
  44. C ing after the initial call and INPPV must not
  45. C be changed by the user. Distinct splines require
  46. C distinct INPPV parameters.
  47. C PPVAL - value of the IDERIV-th derivative at X
  48. C
  49. C Error Conditions
  50. C Improper input is a fatal error
  51. C
  52. C***REFERENCES Carl de Boor, Package for calculating with B-splines,
  53. C SIAM Journal on Numerical Analysis 14, 3 (June 1977),
  54. C pp. 441-472.
  55. C***ROUTINES CALLED INTRV, XERMSG
  56. C***REVISION HISTORY (YYMMDD)
  57. C 800901 DATE WRITTEN
  58. C 890531 Changed all specific intrinsics to generic. (WRB)
  59. C 890831 Modified array declarations. (WRB)
  60. C 890831 REVISION DATE from Version 3.2
  61. C 891214 Prologue converted to Version 4.0 format. (BAB)
  62. C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
  63. C 920501 Reformatted the REFERENCES section. (WRB)
  64. C***END PROLOGUE PPVAL
  65. C
  66. INTEGER I, IDERIV, INPPV, J, K, LDC, LXI, NDUMMY
  67. REAL C, DX, FLTK, X, XI
  68. DIMENSION XI(*), C(LDC,*)
  69. C***FIRST EXECUTABLE STATEMENT PPVAL
  70. PPVAL = 0.0E0
  71. IF(K.LT.1) GO TO 90
  72. IF(LDC.LT.K) GO TO 80
  73. IF(LXI.LT.1) GO TO 85
  74. IF(IDERIV.LT.0 .OR. IDERIV.GE.K) GO TO 95
  75. I = K - IDERIV
  76. FLTK = I
  77. CALL INTRV(XI, LXI, X, INPPV, I, NDUMMY)
  78. DX = X - XI(I)
  79. J = K
  80. 10 PPVAL = (PPVAL/FLTK)*DX + C(J,I)
  81. J = J - 1
  82. FLTK = FLTK - 1.0E0
  83. IF (FLTK.GT.0.0E0) GO TO 10
  84. RETURN
  85. C
  86. C
  87. 80 CONTINUE
  88. CALL XERMSG ('SLATEC', 'PPVAL', 'LDC DOES NOT SATISFY LDC.GE.K',
  89. + 2, 1)
  90. RETURN
  91. 85 CONTINUE
  92. CALL XERMSG ('SLATEC', 'PPVAL', 'LXI DOES NOT SATISFY LXI.GE.1',
  93. + 2, 1)
  94. RETURN
  95. 90 CONTINUE
  96. CALL XERMSG ('SLATEC', 'PPVAL', 'K DOES NOT SATISFY K.GE.1', 2,
  97. + 1)
  98. RETURN
  99. 95 CONTINUE
  100. CALL XERMSG ('SLATEC', 'PPVAL',
  101. + 'IDERIV DOES NOT SATISFY 0.LE.IDERIV.LT.K', 2, 1)
  102. RETURN
  103. END