00001 SUBROUTINE CUOIK(Z, FNU, KODE, IKFLG, N, Y, NUF, TOL, ELIM, ALIM)
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 COMPLEX ARG, ASUM, BSUM, CWRK, CZ, CZERO, PHI, SUM, Y, Z, ZB,
00028 * ZETA1, ZETA2, ZN, ZR
00029 REAL AARG, AIC, ALIM, APHI, ASCLE, AX, AY, ELIM, FNN, FNU, GNN,
00030 * GNU, RCZ, TOL, X, YY
00031 INTEGER I, IFORM, IKFLG, INIT, KODE, N, NN, NUF, NW
00032 DIMENSION Y(N), CWRK(16)
00033 DATA CZERO / (0.0E0,0.0E0) /
00034 DATA AIC / 1.265512123484645396E+00 /
00035 NUF = 0
00036 NN = N
00037 X = REAL(Z)
00038 ZR = Z
00039 IF (X.LT.0.0E0) ZR = -Z
00040 ZB = ZR
00041 YY = AIMAG(ZR)
00042 AX = ABS(X)*1.7321E0
00043 AY = ABS(YY)
00044 IFORM = 1
00045 IF (AY.GT.AX) IFORM = 2
00046 GNU = AMAX1(FNU,1.0E0)
00047 IF (IKFLG.EQ.1) GO TO 10
00048 FNN = FLOAT(NN)
00049 GNN = FNU + FNN - 1.0E0
00050 GNU = AMAX1(GNN,FNN)
00051 10 CONTINUE
00052
00053
00054
00055
00056
00057 IF (IFORM.EQ.2) GO TO 20
00058 INIT = 0
00059 CALL CUNIK(ZR, GNU, IKFLG, 1, TOL, INIT, PHI, ZETA1, ZETA2, SUM,
00060 * CWRK)
00061 CZ = -ZETA1 + ZETA2
00062 GO TO 40
00063 20 CONTINUE
00064 ZN = -ZR*CMPLX(0.0E0,1.0E0)
00065 IF (YY.GT.0.0E0) GO TO 30
00066 ZN = CONJG(-ZN)
00067 30 CONTINUE
00068 CALL CUNHJ(ZN, GNU, 1, TOL, PHI, ARG, ZETA1, ZETA2, ASUM, BSUM)
00069 CZ = -ZETA1 + ZETA2
00070 AARG = CABS(ARG)
00071 40 CONTINUE
00072 IF (KODE.EQ.2) CZ = CZ - ZB
00073 IF (IKFLG.EQ.2) CZ = -CZ
00074 APHI = CABS(PHI)
00075 RCZ = REAL(CZ)
00076
00077
00078
00079 IF (RCZ.GT.ELIM) GO TO 170
00080 IF (RCZ.LT.ALIM) GO TO 50
00081 RCZ = RCZ + ALOG(APHI)
00082 IF (IFORM.EQ.2) RCZ = RCZ - 0.25E0*ALOG(AARG) - AIC
00083 IF (RCZ.GT.ELIM) GO TO 170
00084 GO TO 100
00085 50 CONTINUE
00086
00087
00088
00089 IF (RCZ.LT.(-ELIM)) GO TO 60
00090 IF (RCZ.GT.(-ALIM)) GO TO 100
00091 RCZ = RCZ + ALOG(APHI)
00092 IF (IFORM.EQ.2) RCZ = RCZ - 0.25E0*ALOG(AARG) - AIC
00093 IF (RCZ.GT.(-ELIM)) GO TO 80
00094 60 CONTINUE
00095 DO 70 I=1,NN
00096 Y(I) = CZERO
00097 70 CONTINUE
00098 NUF = NN
00099 RETURN
00100 80 CONTINUE
00101 ASCLE = 1.0E+3*R1MACH(1)/TOL
00102 CZ = CZ + CLOG(PHI)
00103 IF (IFORM.EQ.1) GO TO 90
00104 CZ = CZ - CMPLX(0.25E0,0.0E0)*CLOG(ARG) - CMPLX(AIC,0.0E0)
00105 90 CONTINUE
00106 AX = EXP(RCZ)/TOL
00107 AY = AIMAG(CZ)
00108 CZ = CMPLX(AX,0.0E0)*CMPLX(COS(AY),SIN(AY))
00109 CALL CUCHK(CZ, NW, ASCLE, TOL)
00110 IF (NW.EQ.1) GO TO 60
00111 100 CONTINUE
00112 IF (IKFLG.EQ.2) RETURN
00113 IF (N.EQ.1) RETURN
00114
00115
00116
00117 110 CONTINUE
00118 GNU = FNU + FLOAT(NN-1)
00119 IF (IFORM.EQ.2) GO TO 120
00120 INIT = 0
00121 CALL CUNIK(ZR, GNU, IKFLG, 1, TOL, INIT, PHI, ZETA1, ZETA2, SUM,
00122 * CWRK)
00123 CZ = -ZETA1 + ZETA2
00124 GO TO 130
00125 120 CONTINUE
00126 CALL CUNHJ(ZN, GNU, 1, TOL, PHI, ARG, ZETA1, ZETA2, ASUM, BSUM)
00127 CZ = -ZETA1 + ZETA2
00128 AARG = CABS(ARG)
00129 130 CONTINUE
00130 IF (KODE.EQ.2) CZ = CZ - ZB
00131 APHI = CABS(PHI)
00132 RCZ = REAL(CZ)
00133 IF (RCZ.LT.(-ELIM)) GO TO 140
00134 IF (RCZ.GT.(-ALIM)) RETURN
00135 RCZ = RCZ + ALOG(APHI)
00136 IF (IFORM.EQ.2) RCZ = RCZ - 0.25E0*ALOG(AARG) - AIC
00137 IF (RCZ.GT.(-ELIM)) GO TO 150
00138 140 CONTINUE
00139 Y(NN) = CZERO
00140 NN = NN - 1
00141 NUF = NUF + 1
00142 IF (NN.EQ.0) RETURN
00143 GO TO 110
00144 150 CONTINUE
00145 ASCLE = 1.0E+3*R1MACH(1)/TOL
00146 CZ = CZ + CLOG(PHI)
00147 IF (IFORM.EQ.1) GO TO 160
00148 CZ = CZ - CMPLX(0.25E0,0.0E0)*CLOG(ARG) - CMPLX(AIC,0.0E0)
00149 160 CONTINUE
00150 AX = EXP(RCZ)/TOL
00151 AY = AIMAG(CZ)
00152 CZ = CMPLX(AX,0.0E0)*CMPLX(COS(AY),SIN(AY))
00153 CALL CUCHK(CZ, NW, ASCLE, TOL)
00154 IF (NW.EQ.1) GO TO 140
00155 RETURN
00156 170 CONTINUE
00157 NUF = -1
00158 RETURN
00159 END