1 SUBROUTINE ZMLRI
(ZR
, ZI
, FNU
, KODE
, N
, YR
, YI
, NZ
, TOL
)
2 C***BEGIN PROLOGUE ZMLRI
3 C***REFER TO ZBESI,ZBESK
5 C ZMLRI COMPUTES THE I BESSEL FUNCTION FOR RE(Z).GE.0.0 BY THE
6 C MILLER ALGORITHM NORMALIZED BY A NEUMANN SERIES.
8 C***ROUTINES CALLED DGAMLN,D1MACH,AZABS,AZEXP,AZLOG,ZMLT
10 C COMPLEX CK,CNORM,CONE,CTWO,CZERO,PT,P1,P2,RZ,SUM,Y,Z
11 DOUBLE PRECISION ACK
, AK
, AP
, AT
, AZ
, BK
, CKI
, CKR
, CNORMI
,
12 * CNORMR
, CONEI
, CONER
, FKAP
, FKK
, FLAM
, FNF
, FNU
, PTI
, PTR
, P1I
,
13 * P1R
, P2I
, P2R
, RAZ
, RHO
, RHO2
, RZI
, RZR
, SCLE
, STI
, STR
, SUMI
,
14 * SUMR
, TFNF
, TOL
, TST
, YI
, YR
, ZEROI
, ZEROR
, ZI
, ZR
, DGAMLN
,
16 INTEGER I
, IAZ
, IDUM
, IFNU
, INU
, ITIME
, K
, KK
, KM
, KODE
, M
, N
, NZ
17 DIMENSION YR
(N
), YI
(N
)
18 DATA ZEROR
,ZEROI
,CONER
,CONEI
/ 0.0D0
, 0.0D0
, 1.0D0
, 0.0D0
/
25 AT
= DBLE
(FLOAT
(IAZ
)) + 1.0D0
38 RHO
= ACK
+ DSQRT
(ACK*ACK
-1.0D0
)
40 TST
= (RHO2
+RHO2
)/((RHO2
-1.0D0
)*(RHO
-1.0D0
))
42 C-----------------------------------------------------------------------
43 C COMPUTE RELATIVE TRUNCATION ERROR INDEX FOR SERIES
44 C-----------------------------------------------------------------------
49 P2R
= P1R
- (CKR*PTR
-CKI*PTI
)
50 P2I
= P1I
- (CKI*PTR
+CKR*PTI
)
56 IF (AP
.GT
.TST*AK*AK
) GO TO 20
63 IF (INU
.LT
.IAZ
) GO TO 40
64 C-----------------------------------------------------------------------
65 C COMPUTE RELATIVE TRUNCATION ERROR FOR RATIOS
66 C-----------------------------------------------------------------------
71 AT
= DBLE
(FLOAT
(INU
)) + 1.0D0
82 P2R
= P1R
- (CKR*PTR
-CKI*PTI
)
83 P2I
= P1I
- (CKR*PTI
+CKI*PTR
)
89 IF (AP
.LT
.TST
) GO TO 30
90 IF (ITIME
.EQ
.2) GO TO 40
92 FLAM
= ACK
+ DSQRT
(ACK*ACK
-1.0D0
)
93 FKAP
= AP
/AZABS
(P1R
,P1I
)
94 RHO
= DMIN1
(FLAM
,FKAP
)
95 TST
= TST*DSQRT
(RHO
/(RHO*RHO
-1.0D0
))
100 C-----------------------------------------------------------------------
101 C BACKWARD RECURRENCE AND SUM NORMALIZING RELATION
102 C-----------------------------------------------------------------------
104 KK
= MAX0
(I
+IAZ
,K
+INU
)
105 FKK
= DBLE
(FLOAT
(KK
))
108 C-----------------------------------------------------------------------
109 C SCALE P2 AND SUM BY SCLE
110 C-----------------------------------------------------------------------
113 FNF
= FNU
- DBLE
(FLOAT
(IFNU
))
115 BK
= DGAMLN
(FKK
+TFNF
+1.0D0
,IDUM
) - DGAMLN
(FKK
+1.0D0
,IDUM
) -
116 * DGAMLN
(TFNF
+1.0D0
,IDUM
)
124 P2R
= P1R
+ (FKK
+FNF
)*(RZR*PTR
-RZI*PTI
)
125 P2I
= P1I
+ (FKK
+FNF
)*(RZI*PTR
+RZR*PTI
)
128 AK
= 1.0D0
- TFNF
/(FKK
+TFNF
)
130 SUMR
= SUMR
+ (ACK
+BK
)*P1R
131 SUMI
= SUMI
+ (ACK
+BK
)*P1I
141 P2R
= P1R
+ (FKK
+FNF
)*(RZR*PTR
-RZI*PTI
)
142 P2I
= P1I
+ (FKK
+FNF
)*(RZI*PTR
+RZR*PTI
)
145 AK
= 1.0D0
- TFNF
/(FKK
+TFNF
)
147 SUMR
= SUMR
+ (ACK
+BK
)*P1R
148 SUMI
= SUMI
+ (ACK
+BK
)*P1I
156 IF (IFNU
.LE
.0) GO TO 90
160 P2R
= P1R
+ (FKK
+FNF
)*(RZR*PTR
-RZI*PTI
)
161 P2I
= P1I
+ (FKK
+FNF
)*(RZR*PTI
+RZI*PTR
)
164 AK
= 1.0D0
- TFNF
/(FKK
+TFNF
)
166 SUMR
= SUMR
+ (ACK
+BK
)*P1R
167 SUMI
= SUMI
+ (ACK
+BK
)*P1I
174 IF (KODE
.EQ
.2) PTR
= ZEROR
175 CALL AZLOG
(RZR
, RZI
, STR
, STI
, IDUM
)
178 AP
= DGAMLN
(1.0D0
+FNF
,IDUM
)
181 C-----------------------------------------------------------------------
182 C THE DIVISION CEXP(PT)/(SUM+P2) IS ALTERED TO AVOID OVERFLOW
183 C IN THE DENOMINATOR BY SQUARING LARGE QUANTITIES
184 C-----------------------------------------------------------------------
189 CALL AZEXP
(PTR
, PTI
, STR
, STI
)
194 CALL ZMLT
(CKR
, CKI
, PTR
, PTI
, CNORMR
, CNORMI
)
196 STR
= YR
(I
)*CNORMR
- YI
(I
)*CNORMI
197 YI
(I
) = YR
(I
)*CNORMI
+ YI
(I
)*CNORMR