My Project
Main Page
Data Types List
Files
File List
File Members
All
Classes
Files
Functions
Variables
Macros
pchdf.F
Go to the documentation of this file.
1
*DECK PCHDF
2
REAL
FUNCTION
pchdf
(K, X, S, IERR)
3
C***BEGIN PROLOGUE PCHDF
4
C***SUBSIDIARY
5
C***PURPOSE Computes divided differences for PCHCE and PCHSP
6
C***LIBRARY SLATEC (PCHIP)
7
C***TYPE SINGLE PRECISION (PCHDF-S, DPCHDF-D)
8
C***AUTHOR Fritsch, F. N., (LLNL)
9
C***DESCRIPTION
10
C
11
C PCHDF: PCHIP Finite Difference Formula
12
C
13
C Uses a divided difference formulation to compute a K-point approx-
14
C imation to the derivative at X(K) based on the data in X and S.
15
C
16
C Called by PCHCE and PCHSP to compute 3- and 4-point boundary
17
C derivative approximations.
18
C
19
C ----------------------------------------------------------------------
20
C
21
C On input:
22
C K is the order of the desired derivative approximation.
23
C K must be at least 3 (error return if not).
24
C X contains the K values of the independent variable.
25
C X need not be ordered, but the values **MUST** be
26
C distinct. (Not checked here.)
27
C S contains the associated slope values:
28
C S(I) = (F(I+1)-F(I))/(X(I+1)-X(I)), I=1(1)K-1.
29
C (Note that S need only be of length K-1.)
30
C
31
C On return:
32
C S will be destroyed.
33
C IERR will be set to -1 if K.LT.2 .
34
C PCHDF will be set to the desired derivative approximation if
35
C IERR=0 or to zero if IERR=-1.
36
C
37
C ----------------------------------------------------------------------
38
C
39
C***SEE ALSO PCHCE, PCHSP
40
C***REFERENCES Carl de Boor, A Practical Guide to Splines, Springer-
41
C Verlag, New York, 1978, pp. 10-16.
42
C***ROUTINES CALLED XERMSG
43
C***REVISION HISTORY (YYMMDD)
44
C 820503 DATE WRITTEN
45
C 820805 Converted to SLATEC library version.
46
C 870813 Minor cosmetic changes.
47
C 890411 Added SAVE statements (Vers. 3.2).
48
C 890411 REVISION DATE from Version 3.2
49
C 891214 Prologue converted to Version 4.0 format. (BAB)
50
C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
51
C 900328 Added TYPE section. (WRB)
52
C 910408 Updated AUTHOR and DATE WRITTEN sections in prologue. (WRB)
53
C 920429 Revised format and order of references. (WRB,FNF)
54
C 930503 Improved purpose. (FNF)
55
C***END PROLOGUE PCHDF
56
C
57
C**End
58
C
59
C DECLARE ARGUMENTS.
60
C
61
INTEGER
k
, ierr
62
REAL
x
(
k
), s(
k
)
63
C
64
C DECLARE LOCAL VARIABLES.
65
C
66
INTEGER
i
,
j
67
REAL
value, zero
68
SAVE
zero
69
DATA
zero /0./
70
C
71
C CHECK FOR LEGAL VALUE OF K.
72
C
73
C***FIRST EXECUTABLE STATEMENT PCHDF
74
IF
(
k
.LT. 3) go to 5001
75
C
76
C COMPUTE COEFFICIENTS OF INTERPOLATING POLYNOMIAL.
77
C
78
DO
10
j
= 2,
k
-1
79
DO
9
i
= 1,
k
-
j
80
s(
i
) = (s(
i
+1)-s(
i
))/(
x
(
i
+
j
)-
x
(
i
))
81
9
CONTINUE
82
10
CONTINUE
83
C
84
C EVALUATE DERIVATIVE AT X(K).
85
C
86
value = s(1)
87
DO
20
i
= 2,
k
-1
88
value = s(
i
) + value*(
x
(
k
)-
x
(
i
))
89
20
CONTINUE
90
C
91
C NORMAL RETURN.
92
C
93
ierr = 0
94
pchdf
= value
95
RETURN
96
C
97
C ERROR RETURN.
98
C
99
5001
CONTINUE
100
C K.LT.3 RETURN.
101
ierr = -1
102
CALL
xermsg
(
'SLATEC'
,
'PCHDF'
,
'K LESS THAN THREE'
, ierr, 1)
103
pchdf
= zero
104
RETURN
105
C------------- LAST LINE OF PCHDF FOLLOWS ------------------------------
106
END
libf
bibio
pchdf.F
Generated on Fri Jun 28 2013 15:58:03 for My Project by
1.8.1.2