2 SUBROUTINE ZUOIK
(ZR
, ZI
, FNU
, KODE
, IKFLG
, N
, YR
, YI
, NUF
, TOL
,
4 C***BEGIN PROLOGUE ZUOIK
6 C***PURPOSE Subsidiary to ZBESH, ZBESI and ZBESK
8 C***TYPE ALL (CUOIK-A, ZUOIK-A)
9 C***AUTHOR Amos, D. E., (SNL)
12 C ZUOIK COMPUTES THE LEADING TERMS OF THE UNIFORM ASYMPTOTIC
13 C EXPANSIONS FOR THE I AND K FUNCTIONS AND COMPARES THEM
14 C (IN LOGARITHMIC FORM) TO ALIM AND ELIM FOR OVER AND UNDERFLOW
15 C WHERE ALIM.LT.ELIM. IF THE MAGNITUDE, BASED ON THE LEADING
16 C EXPONENTIAL, IS LESS THAN ALIM OR GREATER THAN -ALIM, THEN
17 C THE RESULT IS ON SCALE. IF NOT, THEN A REFINED TEST USING OTHER
18 C MULTIPLIERS (IN LOGARITHMIC FORM) IS MADE BASED ON ELIM. HERE
19 C EXP(-ELIM)=SMALLEST MACHINE NUMBER*1.0E+3 AND EXP(-ALIM)=
22 C IKFLG=1 MEANS THE I SEQUENCE IS TESTED
23 C =2 MEANS THE K SEQUENCE IS TESTED
24 C NUF = 0 MEANS THE LAST MEMBER OF THE SEQUENCE IS ON SCALE
25 C =-1 MEANS AN OVERFLOW WOULD OCCUR
26 C IKFLG=1 AND NUF.GT.0 MEANS THE LAST NUF Y VALUES WERE SET TO ZERO
27 C THE FIRST N-NUF VALUES MUST BE SET BY ANOTHER ROUTINE
28 C IKFLG=2 AND NUF.EQ.N MEANS ALL Y VALUES WERE SET TO ZERO
29 C IKFLG=2 AND 0.LT.NUF.LT.N NOT CONSIDERED. Y MUST BE SET BY
32 C***SEE ALSO ZBESH, ZBESI, ZBESK
33 C***ROUTINES CALLED D1MACH, ZABS, ZLOG, ZUCHK, ZUNHJ, ZUNIK
34 C***REVISION HISTORY (YYMMDD)
36 C 910415 Prologue converted to Version 4.0 format. (BAB)
37 C 930122 Added ZLOG to EXTERNAL statement. (RWC)
38 C***END PROLOGUE ZUOIK
39 C COMPLEX ARG,ASUM,BSUM,CWRK,CZ,CZERO,PHI,SUM,Y,Z,ZB,ZETA1,ZETA2,ZN,
41 DOUBLE PRECISION AARG
, AIC
, ALIM
, APHI
, ARGI
, ARGR
, ASUMI
, ASUMR
,
42 * ASCLE
, AX
, AY
, BSUMI
, BSUMR
, CWRKI
, CWRKR
, CZI
, CZR
, ELIM
, FNN
,
43 * FNU
, GNN
, GNU
, PHII
, PHIR
, RCZ
, STR
, STI
, SUMI
, SUMR
, TOL
, YI
,
44 * YR
, ZBI
, ZBR
, ZEROI
, ZEROR
, ZETA1I
, ZETA1R
, ZETA2I
, ZETA2R
, ZI
,
45 * ZNI
, ZNR
, ZR
, ZRI
, ZRR
, D1MACH
, ZABS
46 INTEGER I
, IDUM
, IFORM
, IKFLG
, INIT
, KODE
, N
, NN
, NUF
, NW
47 DIMENSION YR
(N
), YI
(N
), CWRKR
(16), CWRKI
(16)
49 DATA ZEROR
,ZEROI
/ 0.0D0
, 0.0D0
/
50 DATA AIC
/ 1.265512123484645396D
+00 /
51 C***FIRST EXECUTABLE STATEMENT ZUOIK
56 IF (ZR
.GE
.0.0D0
) GO TO 10
65 IF (AY
.GT
.AX
) IFORM
= 2
67 IF (IKFLG
.EQ
.1) GO TO 20
69 GNN
= FNU
+ FNN
- 1.0D0
72 C-----------------------------------------------------------------------
73 C ONLY THE MAGNITUDE OF ARG AND PHI ARE NEEDED ALONG WITH THE
74 C REAL PARTS OF ZETA1, ZETA2 AND ZB. NO ATTEMPT IS MADE TO GET
75 C THE SIGN OF THE IMAGINARY PART CORRECT.
76 C-----------------------------------------------------------------------
77 IF (IFORM
.EQ
.2) GO TO 30
79 CALL ZUNIK
(ZRR
, ZRI
, GNU
, IKFLG
, 1, TOL
, INIT
, PHIR
, PHII
,
80 * ZETA1R
, ZETA1I
, ZETA2R
, ZETA2I
, SUMR
, SUMI
, CWRKR
, CWRKI
)
81 CZR
= -ZETA1R
+ ZETA2R
82 CZI
= -ZETA1I
+ ZETA2I
87 IF (ZI
.GT
.0.0D0
) GO TO 40
90 CALL ZUNHJ
(ZNR
, ZNI
, GNU
, 1, TOL
, PHIR
, PHII
, ARGR
, ARGI
, ZETA1R
,
91 * ZETA1I
, ZETA2R
, ZETA2I
, ASUMR
, ASUMI
, BSUMR
, BSUMI
)
92 CZR
= -ZETA1R
+ ZETA2R
93 CZI
= -ZETA1I
+ ZETA2I
94 AARG
= ZABS
(ARGR
,ARGI
)
96 IF (KODE
.EQ
.1) GO TO 60
100 IF (IKFLG
.EQ
.1) GO TO 70
104 APHI
= ZABS
(PHIR
,PHII
)
106 C-----------------------------------------------------------------------
108 C-----------------------------------------------------------------------
109 IF (RCZ
.GT
.ELIM
) GO TO 210
110 IF (RCZ
.LT
.ALIM
) GO TO 80
111 RCZ
= RCZ
+ LOG
(APHI
)
112 IF (IFORM
.EQ
.2) RCZ
= RCZ
- 0.25D0*LOG
(AARG
) - AIC
113 IF (RCZ
.GT
.ELIM
) GO TO 210
116 C-----------------------------------------------------------------------
118 C-----------------------------------------------------------------------
119 IF (RCZ
.LT
.(-ELIM
)) GO TO 90
120 IF (RCZ
.GT
.(-ALIM
)) GO TO 130
121 RCZ
= RCZ
+ LOG
(APHI
)
122 IF (IFORM
.EQ
.2) RCZ
= RCZ
- 0.25D0*LOG
(AARG
) - AIC
123 IF (RCZ
.GT
.(-ELIM
)) GO TO 110
132 ASCLE
= 1.0D
+3*D1MACH
(1)/TOL
133 CALL ZLOG
(PHIR
, PHII
, STR
, STI
, IDUM
)
136 IF (IFORM
.EQ
.1) GO TO 120
137 CALL ZLOG
(ARGR
, ARGI
, STR
, STI
, IDUM
)
138 CZR
= CZR
- 0.25D0*STR
- AIC
139 CZI
= CZI
- 0.25D0*STI
145 CALL ZUCHK
(CZR
, CZI
, NW
, ASCLE
, TOL
)
146 IF (NW
.NE
.0) GO TO 90
148 IF (IKFLG
.EQ
.2) RETURN
150 C-----------------------------------------------------------------------
151 C SET UNDERFLOWS ON I SEQUENCE
152 C-----------------------------------------------------------------------
155 IF (IFORM
.EQ
.2) GO TO 150
157 CALL ZUNIK
(ZRR
, ZRI
, GNU
, IKFLG
, 1, TOL
, INIT
, PHIR
, PHII
,
158 * ZETA1R
, ZETA1I
, ZETA2R
, ZETA2I
, SUMR
, SUMI
, CWRKR
, CWRKI
)
159 CZR
= -ZETA1R
+ ZETA2R
160 CZI
= -ZETA1I
+ ZETA2I
163 CALL ZUNHJ
(ZNR
, ZNI
, GNU
, 1, TOL
, PHIR
, PHII
, ARGR
, ARGI
, ZETA1R
,
164 * ZETA1I
, ZETA2R
, ZETA2I
, ASUMR
, ASUMI
, BSUMR
, BSUMI
)
165 CZR
= -ZETA1R
+ ZETA2R
166 CZI
= -ZETA1I
+ ZETA2I
167 AARG
= ZABS
(ARGR
,ARGI
)
169 IF (KODE
.EQ
.1) GO TO 170
173 APHI
= ZABS
(PHIR
,PHII
)
175 IF (RCZ
.LT
.(-ELIM
)) GO TO 180
176 IF (RCZ
.GT
.(-ALIM
)) RETURN
177 RCZ
= RCZ
+ LOG
(APHI
)
178 IF (IFORM
.EQ
.2) RCZ
= RCZ
- 0.25D0*LOG
(AARG
) - AIC
179 IF (RCZ
.GT
.(-ELIM
)) GO TO 190
188 ASCLE
= 1.0D
+3*D1MACH
(1)/TOL
189 CALL ZLOG
(PHIR
, PHII
, STR
, STI
, IDUM
)
192 IF (IFORM
.EQ
.1) GO TO 200
193 CALL ZLOG
(ARGR
, ARGI
, STR
, STI
, IDUM
)
194 CZR
= CZR
- 0.25D0*STR
- AIC
195 CZI
= CZI
- 0.25D0*STI
201 CALL ZUCHK
(CZR
, CZI
, NW
, ASCLE
, TOL
)
202 IF (NW
.NE
.0) GO TO 180