comparison libcruft/slatec-fn/r9lgit.f @ 7789:82be108cc558

First attempt at single precision tyeps * * * corrections to qrupdate single precision routines * * * prefer demotion to single over promotion to double * * * Add single precision support to log2 function * * * Trivial PROJECT file update * * * Cache optimized hermitian/transpose methods * * * Add tests for tranpose/hermitian and ChangeLog entry for new transpose code
author David Bateman <dbateman@free.fr>
date Sun, 27 Apr 2008 22:34:17 +0200
parents
children
comparison
equal deleted inserted replaced
7788:45f5faba05a2 7789:82be108cc558
1 *DECK R9LGIT
2 FUNCTION R9LGIT (A, X, ALGAP1)
3 C***BEGIN PROLOGUE R9LGIT
4 C***SUBSIDIARY
5 C***PURPOSE Compute the logarithm of Tricomi's incomplete Gamma
6 C function with Perron's continued fraction for large X and
7 C A .GE. X.
8 C***LIBRARY SLATEC (FNLIB)
9 C***CATEGORY C7E
10 C***TYPE SINGLE PRECISION (R9LGIT-S, D9LGIT-D)
11 C***KEYWORDS FNLIB, INCOMPLETE GAMMA FUNCTION, LOGARITHM,
12 C PERRON'S CONTINUED FRACTION, SPECIAL FUNCTIONS, TRICOMI
13 C***AUTHOR Fullerton, W., (LANL)
14 C***DESCRIPTION
15 C
16 C Compute the log of Tricomi's incomplete gamma function with Perron's
17 C continued fraction for large X and for A .GE. X.
18 C
19 C***REFERENCES (NONE)
20 C***ROUTINES CALLED R1MACH, XERMSG
21 C***REVISION HISTORY (YYMMDD)
22 C 770701 DATE WRITTEN
23 C 890531 Changed all specific intrinsics to generic. (WRB)
24 C 890531 REVISION DATE from Version 3.2
25 C 891214 Prologue converted to Version 4.0 format. (BAB)
26 C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
27 C 900720 Routine changed from user-callable to subsidiary. (WRB)
28 C***END PROLOGUE R9LGIT
29 SAVE EPS, SQEPS
30 DATA EPS, SQEPS / 2*0.0 /
31 C***FIRST EXECUTABLE STATEMENT R9LGIT
32 IF (EPS.EQ.0.0) EPS = 0.5*R1MACH(3)
33 IF (SQEPS.EQ.0.0) SQEPS = SQRT(R1MACH(4))
34 C
35 IF (X .LE. 0.0 .OR. A .LT. X) CALL XERMSG ('SLATEC', 'R9LGIT',
36 + 'X SHOULD BE GT 0.0 AND LE A', 2, 2)
37 C
38 AX = A + X
39 A1X = AX + 1.0
40 R = 0.0
41 P = 1.0
42 S = P
43 DO 20 K=1,200
44 FK = K
45 T = (A+FK)*X*(1.0+R)
46 R = T/((AX+FK)*(A1X+FK)-T)
47 P = R*P
48 S = S + P
49 IF (ABS(P).LT.EPS*S) GO TO 30
50 20 CONTINUE
51 CALL XERMSG ('SLATEC', 'R9LGIT',
52 + 'NO CONVERGENCE IN 200 TERMS OF CONTINUED FRACTION', 3, 2)
53 C
54 30 HSTAR = 1.0 - X*S/A1X
55 IF (HSTAR .LT. SQEPS) CALL XERMSG ('SLATEC', 'R9LGIT',
56 + 'RESULT LESS THAN HALF PRECISION', 1, 1)
57 C
58 R9LGIT = -X - ALGAP1 - LOG(HSTAR)
59 C
60 RETURN
61 END