1 SUBROUTINE ZUNI2
(ZR
, ZI
, FNU
, KODE
, N
, YR
, YI
, NZ
, NLAST
, FNUL
,
3 C***BEGIN PROLOGUE ZUNI2
4 C***REFER TO ZBESI,ZBESK
6 C ZUNI2 COMPUTES I(FNU,Z) IN THE RIGHT HALF PLANE BY MEANS OF
7 C UNIFORM ASYMPTOTIC EXPANSION FOR J(FNU,ZN) WHERE ZN IS Z*I
8 C OR -Z*I AND ZN IS IN THE RIGHT HALF PLANE ALSO.
10 C FNUL IS THE SMALLEST ORDER PERMITTED FOR THE ASYMPTOTIC
11 C EXPANSION. NLAST=0 MEANS ALL OF THE Y VALUES WERE SET.
12 C NLAST.NE.0 IS THE NUMBER LEFT TO BE COMPUTED BY ANOTHER
13 C FORMULA FOR ORDERS FNU TO FNU+NLAST-1 BECAUSE FNU+NLAST-1.LT.FNUL.
14 C Y(I)=CZERO FOR I=NLAST+1,N
16 C***ROUTINES CALLED ZAIRY,ZUCHK,ZUNHJ,ZUOIK,D1MACH,AZABS
17 C***END PROLOGUE ZUNI2
18 C COMPLEX AI,ARG,ASUM,BSUM,CFN,CI,CID,CIP,CONE,CRSC,CSCL,CSR,CSS,
19 C *CZERO,C1,C2,DAI,PHI,RZ,S1,S2,Y,Z,ZB,ZETA1,ZETA2,ZN
20 DOUBLE PRECISION AARG
, AIC
, AII
, AIR
, ALIM
, ANG
, APHI
, ARGI
,
21 * ARGR
, ASCLE
, ASUMI
, ASUMR
, BRY
, BSUMI
, BSUMR
, CIDI
, CIPI
, CIPR
,
22 * CONER
, CRSC
, CSCL
, CSRR
, CSSR
, C1R
, C2I
, C2M
, C2R
, DAII
,
23 * DAIR
, ELIM
, FN
, FNU
, FNUL
, HPI
, PHII
, PHIR
, RAST
, RAZ
, RS1
, RZI
,
24 * RZR
, STI
, STR
, S1I
, S1R
, S2I
, S2R
, TOL
, YI
, YR
, ZBI
, ZBR
, ZEROI
,
25 * ZEROR
, ZETA1I
, ZETA1R
, ZETA2I
, ZETA2R
, ZI
, ZNI
, ZNR
, ZR
, CYR
,
26 * CYI
, D1MACH
, AZABS
, CAR
, SAR
27 INTEGER I
, IFLAG
, IN
, INU
, J
, K
, KODE
, N
, NAI
, ND
, NDAI
, NLAST
,
28 * NN
, NUF
, NW
, NZ
, IDUM
29 DIMENSION BRY
(3), YR
(N
), YI
(N
), CIPR
(4), CIPI
(4), CSSR
(3),
30 * CSRR
(3), CYR
(2), CYI
(2)
31 DATA ZEROR
,ZEROI
,CONER
/ 0.0D0
, 0.0D0
, 1.0D0
/
32 DATA CIPR
(1),CIPI
(1),CIPR
(2),CIPI
(2),CIPR
(3),CIPI
(3),CIPR
(4),
33 * CIPI
(4)/ 1.0D0
,0.0D0
, 0.0D0
,1.0D0
, -1.0D0
,0.0D0
, 0.0D0
,-1.0D0
/
35 1 1.57079632679489662D
+00, 1.265512123484645396D
+00/
40 C-----------------------------------------------------------------------
41 C COMPUTED VALUES WITH EXPONENTS BETWEEN ALIM AND ELIM IN MAG-
42 C NITUDE ARE SCALED TO KEEP INTERMEDIATE ARITHMETIC ON SCALE,
43 C EXP(ALIM)=EXP(ELIM)*TOL
44 C-----------------------------------------------------------------------
53 BRY
(1) = 1.0D
+3*D1MACH
(1)/TOL
54 C-----------------------------------------------------------------------
55 C ZN IS IN THE RIGHT HALF PLANE AFTER ROTATION BY CI OR -CI
56 C-----------------------------------------------------------------------
63 ANG
= HPI*
(FNU
-DBLE
(FLOAT
(INU
)))
70 STR
= C2R*CIPR
(IN
) - C2I*CIPI
(IN
)
71 C2I
= C2R*CIPI
(IN
) + C2I*CIPR
(IN
)
73 IF (ZI
.GT
.0.0D0
) GO TO 10
79 C-----------------------------------------------------------------------
80 C CHECK FOR UNDERFLOW AND OVERFLOW ON FIRST MEMBER
81 C-----------------------------------------------------------------------
83 CALL ZUNHJ
(ZNR
, ZNI
, FN
, 1, TOL
, PHIR
, PHII
, ARGR
, ARGI
, ZETA1R
,
84 * ZETA1I
, ZETA2R
, ZETA2I
, ASUMR
, ASUMI
, BSUMR
, BSUMI
)
85 IF (KODE
.EQ
.1) GO TO 20
88 RAST
= FN
/AZABS
(STR
,STI
)
95 S1R
= -ZETA1R
+ ZETA2R
96 S1I
= -ZETA1I
+ ZETA2I
99 IF (DABS
(RS1
).GT
.ELIM
) GO TO 150
103 FN
= FNU
+ DBLE
(FLOAT
(ND
-I
))
104 CALL ZUNHJ
(ZNR
, ZNI
, FN
, 0, TOL
, PHIR
, PHII
, ARGR
, ARGI
,
105 * ZETA1R
, ZETA1I
, ZETA2R
, ZETA2I
, ASUMR
, ASUMI
, BSUMR
, BSUMI
)
106 IF (KODE
.EQ
.1) GO TO 50
109 RAST
= FN
/AZABS
(STR
,STI
)
113 S1I
= -ZETA1I
+ STI
+ DABS
(ZI
)
116 S1R
= -ZETA1R
+ ZETA2R
117 S1I
= -ZETA1I
+ ZETA2I
119 C-----------------------------------------------------------------------
120 C TEST FOR UNDERFLOW AND OVERFLOW
121 C-----------------------------------------------------------------------
123 IF (DABS
(RS1
).GT
.ELIM
) GO TO 120
124 IF (I
.EQ
.1) IFLAG
= 2
125 IF (DABS
(RS1
).LT
.ALIM
) GO TO 70
126 C-----------------------------------------------------------------------
127 C REFINE TEST AND SCALE
128 C-----------------------------------------------------------------------
129 C-----------------------------------------------------------------------
130 APHI
= AZABS
(PHIR
,PHII
)
131 AARG
= AZABS
(ARGR
,ARGI
)
132 RS1
= RS1
+ DLOG
(APHI
) - 0.25D0*DLOG
(AARG
) - AIC
133 IF (DABS
(RS1
).GT
.ELIM
) GO TO 120
134 IF (I
.EQ
.1) IFLAG
= 1
135 IF (RS1
.LT
.0.0D0
) GO TO 70
136 IF (I
.EQ
.1) IFLAG
= 3
138 C-----------------------------------------------------------------------
139 C SCALE S1 TO KEEP INTERMEDIATE ARITHMETIC ON SCALE NEAR
141 C-----------------------------------------------------------------------
142 CALL ZAIRY
(ARGR
, ARGI
, 0, 2, AIR
, AII
, NAI
, IDUM
)
143 CALL ZAIRY
(ARGR
, ARGI
, 1, 2, DAIR
, DAII
, NDAI
, IDUM
)
144 STR
= DAIR*BSUMR
- DAII*BSUMI
145 STI
= DAIR*BSUMI
+ DAII*BSUMR
146 STR
= STR
+ (AIR*ASUMR
-AII*ASUMI
)
147 STI
= STI
+ (AIR*ASUMI
+AII*ASUMR
)
148 S2R
= PHIR*STR
- PHII*STI
149 S2I
= PHIR*STI
+ PHII*STR
150 STR
= DEXP
(S1R
)*CSSR
(IFLAG
)
153 STR
= S2R*S1R
- S2I*S1I
154 S2I
= S2R*S1I
+ S2I*S1R
156 IF (IFLAG
.NE
.1) GO TO 80
157 CALL ZUCHK
(S2R
, S2I
, NW
, BRY
(1), TOL
)
158 IF (NW
.NE
.0) GO TO 120
160 IF (ZI
.LE
.0.0D0
) S2I
= -S2I
161 STR
= S2R*C2R
- S2I*C2I
162 S2I
= S2R*C2I
+ S2I*C2R
167 YR
(J
) = S2R*CSRR
(IFLAG
)
168 YI
(J
) = S2I*CSRR
(IFLAG
)
173 IF (ND
.LE
.2) GO TO 110
174 RAZ
= 1.0D0
/AZABS
(ZR
,ZI
)
179 BRY
(2) = 1.0D0
/BRY
(1)
192 S2R
= S1R
+ (FNU
+FN
)*(RZR*C2R
-RZI*C2I
)
193 S2I
= S1I
+ (FNU
+FN
)*(RZR*C2I
+RZI*C2R
)
202 IF (IFLAG
.GE
.3) GO TO 100
206 IF (C2M
.LE
.ASCLE
) GO TO 100
213 S1R
= S1R*CSSR
(IFLAG
)
214 S1I
= S1I*CSSR
(IFLAG
)
215 S2R
= S2R*CSSR
(IFLAG
)
216 S2I
= S2I*CSSR
(IFLAG
)
222 IF (RS1
.GT
.0.0D0
) GO TO 140
223 C-----------------------------------------------------------------------
224 C SET UNDERFLOW AND UPDATE PARAMETERS
225 C-----------------------------------------------------------------------
230 IF (ND
.EQ
.0) GO TO 110
231 CALL ZUOIK
(ZR
, ZI
, FNU
, KODE
, 1, ND
, YR
, YI
, NUF
, TOL
, ELIM
, ALIM
)
232 IF (NUF
.LT
.0) GO TO 140
235 IF (ND
.EQ
.0) GO TO 110
236 FN
= FNU
+ DBLE
(FLOAT
(ND
-1))
237 IF (FN
.LT
.FNUL
) GO TO 130
243 C IF (FN.LT.0.0D0) S1I = -S1I
244 C STR = C2R*S1R - C2I*S1I
245 C C2I = C2R*S1I + C2I*S1R
249 C2R
= CAR*CIPR
(IN
) - SAR*CIPI
(IN
)
250 C2I
= CAR*CIPI
(IN
) + SAR*CIPR
(IN
)
251 IF (ZI
.LE
.0.0D0
) C2I
= -C2I
260 IF (RS1
.GT
.0.0D0
) GO TO 140