dppval.f 3.8 KB

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