2 SUBROUTINE ZSERI
(ZR
, ZI
, FNU
, KODE
, N
, YR
, YI
, NZ
, TOL
, ELIM
,
4 C***BEGIN PROLOGUE ZSERI
6 C***PURPOSE Subsidiary to ZBESI and ZBESK
8 C***TYPE ALL (CSERI-A, ZSERI-A)
9 C***AUTHOR Amos, D. E., (SNL)
12 C ZSERI COMPUTES THE I BESSEL FUNCTION FOR REAL(Z).GE.0.0 BY
13 C MEANS OF THE POWER SERIES FOR LARGE ABS(Z) IN THE
14 C REGION ABS(Z).LE.2*SQRT(FNU+1). NZ=0 IS A NORMAL RETURN.
15 C NZ.GT.0 MEANS THAT THE LAST NZ COMPONENTS WERE SET TO ZERO
16 C DUE TO UNDERFLOW. NZ.LT.0 MEANS UNDERFLOW OCCURRED, BUT THE
17 C CONDITION ABS(Z).LE.2*SQRT(FNU+1) WAS VIOLATED AND THE
18 C COMPUTATION MUST BE COMPLETED IN ANOTHER ROUTINE WITH N=N-ABS(NZ).
20 C***SEE ALSO ZBESI, ZBESK
21 C***ROUTINES CALLED D1MACH, DGAMLN, ZABS, ZDIV, ZLOG, ZMLT, ZUCHK
22 C***REVISION HISTORY (YYMMDD)
24 C 910415 Prologue converted to Version 4.0 format. (BAB)
25 C 930122 Added ZLOG to EXTERNAL statement. (RWC)
26 C***END PROLOGUE ZSERI
27 C COMPLEX AK1,CK,COEF,CONE,CRSC,CSCL,CZ,CZERO,HZ,RZ,S1,S2,Y,Z
28 DOUBLE PRECISION AA
, ACZ
, AK
, AK1I
, AK1R
, ALIM
, ARM
, ASCLE
, ATOL
,
29 * AZ
, CKI
, CKR
, COEFI
, COEFR
, CONEI
, CONER
, CRSCR
, CZI
, CZR
, DFNU
,
30 * ELIM
, FNU
, FNUP
, HZI
, HZR
, RAZ
, RS
, RTR1
, RZI
, RZR
, S
, SS
, STI
,
31 * STR
, S1I
, S1R
, S2I
, S2R
, TOL
, YI
, YR
, WI
, WR
, ZEROI
, ZEROR
, ZI
,
32 * ZR
, DGAMLN
, D1MACH
, ZABS
33 INTEGER I
, IB
, IDUM
, IFLAG
, IL
, K
, KODE
, L
, M
, N
, NN
, NZ
, NW
34 DIMENSION YR
(N
), YI
(N
), WR
(2), WI
(2)
36 DATA ZEROR
,ZEROI
,CONER
,CONEI
/ 0.0D0
, 0.0D0
, 1.0D0
, 0.0D0
/
37 C***FIRST EXECUTABLE STATEMENT ZSERI
40 IF (AZ
.EQ
.0.0D0
) GO TO 160
41 ARM
= 1.0D
+3*D1MACH
(1)
45 IF (AZ
.LT
.ARM
) GO TO 150
50 IF (AZ
.LE
.RTR1
) GO TO 10
51 CALL ZMLT
(HZR
, HZI
, HZR
, HZI
, CZR
, CZI
)
55 CALL ZLOG
(HZR
, HZI
, CKR
, CKI
, IDUM
)
59 C-----------------------------------------------------------------------
61 C-----------------------------------------------------------------------
64 AK
= DGAMLN
(FNUP
,IDUM
)
66 IF (KODE
.EQ
.2) AK1R
= AK1R
- ZR
67 IF (AK1R
.GT
.(-ELIM
)) GO TO 40
72 IF (ACZ
.GT
.DFNU
) GO TO 190
77 IF (AK1R
.GT
.(-ALIM
)) GO TO 50
84 IF (IFLAG
.EQ
.1) AA
= AA*SS
94 IF (ACZ
.LT
.TOL*FNUP
) GO TO 70
102 STR
= AK1R*CZR
- AK1I*CZI
103 STI
= AK1R*CZI
+ AK1I*CZR
111 IF (AA
.GT
.ATOL
) GO TO 60
113 S2R
= S1R*COEFR
- S1I*COEFI
114 S2I
= S1R*COEFI
+ S1I*COEFR
117 IF (IFLAG
.EQ
.0) GO TO 80
118 CALL ZUCHK
(S2R
, S2I
, NW
, ASCLE
, TOL
)
119 IF (NW
.NE
.0) GO TO 30
124 IF (I
.EQ
.IL
) GO TO 90
125 CALL ZDIV
(COEFR
, COEFI
, HZR
, HZI
, STR
, STI
)
137 IF (IFLAG
.EQ
.1) GO TO 120
141 YR
(K
) = (AK
+FNU
)*(RZR*YR
(K
+1)-RZI*YI
(K
+1)) + YR
(K
+2)
142 YI
(K
) = (AK
+FNU
)*(RZR*YI
(K
+1)+RZI*YR
(K
+1)) + YI
(K
+2)
147 C-----------------------------------------------------------------------
148 C RECUR BACKWARD WITH SCALED VALUES
149 C-----------------------------------------------------------------------
151 C-----------------------------------------------------------------------
152 C EXP(-ALIM)=EXP(-ELIM)/TOL=APPROX. ONE PRECISION ABOVE THE
153 C UNDERFLOW LIMIT = ASCLE = D1MACH(1)*SS*1.0D+3
154 C-----------------------------------------------------------------------
162 S2R
= S1R
+ (AK
+FNU
)*(RZR*CKR
-RZI*CKI
)
163 S2I
= S1I
+ (AK
+FNU
)*(RZR*CKI
+RZI*CKR
)
172 IF (ZABS
(CKR
,CKI
).GT
.ASCLE
) GO TO 140
181 IF (FNU
.EQ
.0.0D0
) NZ
= NZ
- 1
185 IF (FNU
.NE
.0.0D0
) GO TO 170
195 C-----------------------------------------------------------------------
196 C RETURN WITH NZ.LT.0 IF ABS(Z*Z/4).GT.FNU+N-NZ-1 COMPLETE
197 C THE CALCULATION IN CBINU WITH N=N-ABS(NZ)
198 C-----------------------------------------------------------------------