cuni1.f

Go to the documentation of this file.
00001       SUBROUTINE CUNI1(Z, FNU, KODE, N, Y, NZ, NLAST, FNUL, TOL, ELIM,
00002      * ALIM)
00003 C***BEGIN PROLOGUE  CUNI1
00004 C***REFER TO  CBESI,CBESK
00005 C
00006 C     CUNI1 COMPUTES I(FNU,Z)  BY MEANS OF THE UNIFORM ASYMPTOTIC
00007 C     EXPANSION FOR I(FNU,Z) IN -PI/3.LE.ARG Z.LE.PI/3.
00008 C
00009 C     FNUL IS THE SMALLEST ORDER PERMITTED FOR THE ASYMPTOTIC
00010 C     EXPANSION. NLAST=0 MEANS ALL OF THE Y VALUES WERE SET.
00011 C     NLAST.NE.0 IS THE NUMBER LEFT TO BE COMPUTED BY ANOTHER
00012 C     FORMULA FOR ORDERS FNU TO FNU+NLAST-1 BECAUSE FNU+NLAST-1.LT.FNUL.
00013 C     Y(I)=CZERO FOR I=NLAST+1,N
00014 C
00015 C***ROUTINES CALLED  CUCHK,CUNIK,CUOIK,R1MACH
00016 C***END PROLOGUE  CUNI1
00017       COMPLEX CFN, CONE, CRSC, CSCL, CSR, CSS, CWRK, CZERO, C1, C2,
00018      * PHI, RZ, SUM, S1, S2, Y, Z, ZETA1, ZETA2, CY
00019       REAL ALIM, APHI, ASCLE, BRY, C2I, C2M, C2R, ELIM, FN, FNU, FNUL,
00020      * RS1, TOL, YY, R1MACH
00021       INTEGER I, IFLAG, INIT, K, KODE, M, N, ND, NLAST, NN, NUF, NW, NZ
00022       DIMENSION BRY(3), Y(N), CWRK(16), CSS(3), CSR(3), CY(2)
00023       DATA CZERO, CONE / (0.0E0,0.0E0), (1.0E0,0.0E0) /
00024 C
00025       NZ = 0
00026       ND = N
00027       NLAST = 0
00028 C-----------------------------------------------------------------------
00029 C     COMPUTED VALUES WITH EXPONENTS BETWEEN ALIM AND ELIM IN MAG-
00030 C     NITUDE ARE SCALED TO KEEP INTERMEDIATE ARITHMETIC ON SCALE,
00031 C     EXP(ALIM)=EXP(ELIM)*TOL
00032 C-----------------------------------------------------------------------
00033       CSCL = CMPLX(1.0E0/TOL,0.0E0)
00034       CRSC = CMPLX(TOL,0.0E0)
00035       CSS(1) = CSCL
00036       CSS(2) = CONE
00037       CSS(3) = CRSC
00038       CSR(1) = CRSC
00039       CSR(2) = CONE
00040       CSR(3) = CSCL
00041       BRY(1) = 1.0E+3*R1MACH(1)/TOL
00042 C-----------------------------------------------------------------------
00043 C     CHECK FOR UNDERFLOW AND OVERFLOW ON FIRST MEMBER
00044 C-----------------------------------------------------------------------
00045       FN = AMAX1(FNU,1.0E0)
00046       INIT = 0
00047       CALL CUNIK(Z, FN, 1, 1, TOL, INIT, PHI, ZETA1, ZETA2, SUM, CWRK)
00048       IF (KODE.EQ.1) GO TO 10
00049       CFN = CMPLX(FN,0.0E0)
00050       S1 = -ZETA1 + CFN*(CFN/(Z+ZETA2))
00051       GO TO 20
00052    10 CONTINUE
00053       S1 = -ZETA1 + ZETA2
00054    20 CONTINUE
00055       RS1 = REAL(S1)
00056       IF (ABS(RS1).GT.ELIM) GO TO 130
00057    30 CONTINUE
00058       NN = MIN0(2,ND)
00059       DO 80 I=1,NN
00060         FN = FNU + FLOAT(ND-I)
00061         INIT = 0
00062         CALL CUNIK(Z, FN, 1, 0, TOL, INIT, PHI, ZETA1, ZETA2, SUM, CWRK)
00063         IF (KODE.EQ.1) GO TO 40
00064         CFN = CMPLX(FN,0.0E0)
00065         YY = AIMAG(Z)
00066         S1 = -ZETA1 + CFN*(CFN/(Z+ZETA2)) + CMPLX(0.0E0,YY)
00067         GO TO 50
00068    40   CONTINUE
00069         S1 = -ZETA1 + ZETA2
00070    50   CONTINUE
00071 C-----------------------------------------------------------------------
00072 C     TEST FOR UNDERFLOW AND OVERFLOW
00073 C-----------------------------------------------------------------------
00074         RS1 = REAL(S1)
00075         IF (ABS(RS1).GT.ELIM) GO TO 110
00076         IF (I.EQ.1) IFLAG = 2
00077         IF (ABS(RS1).LT.ALIM) GO TO 60
00078 C-----------------------------------------------------------------------
00079 C     REFINE  TEST AND SCALE
00080 C-----------------------------------------------------------------------
00081         APHI = CABS(PHI)
00082         RS1 = RS1 + ALOG(APHI)
00083         IF (ABS(RS1).GT.ELIM) GO TO 110
00084         IF (I.EQ.1) IFLAG = 1
00085         IF (RS1.LT.0.0E0) GO TO 60
00086         IF (I.EQ.1) IFLAG = 3
00087    60   CONTINUE
00088 C-----------------------------------------------------------------------
00089 C     SCALE S1 IF CABS(S1).LT.ASCLE
00090 C-----------------------------------------------------------------------
00091         S2 = PHI*SUM
00092         C2R = REAL(S1)
00093         C2I = AIMAG(S1)
00094         C2M = EXP(C2R)*REAL(CSS(IFLAG))
00095         S1 = CMPLX(C2M,0.0E0)*CMPLX(COS(C2I),SIN(C2I))
00096         S2 = S2*S1
00097         IF (IFLAG.NE.1) GO TO 70
00098         CALL CUCHK(S2, NW, BRY(1), TOL)
00099         IF (NW.NE.0) GO TO 110
00100    70   CONTINUE
00101         M = ND - I + 1
00102         CY(I) = S2
00103         Y(M) = S2*CSR(IFLAG)
00104    80 CONTINUE
00105       IF (ND.LE.2) GO TO 100
00106       RZ = CMPLX(2.0E0,0.0E0)/Z
00107       BRY(2) = 1.0E0/BRY(1)
00108       BRY(3) = R1MACH(2)
00109       S1 = CY(1)
00110       S2 = CY(2)
00111       C1 = CSR(IFLAG)
00112       ASCLE = BRY(IFLAG)
00113       K = ND - 2
00114       FN = FLOAT(K)
00115       DO 90 I=3,ND
00116         C2 = S2
00117         S2 = S1 + CMPLX(FNU+FN,0.0E0)*RZ*S2
00118         S1 = C2
00119         C2 = S2*C1
00120         Y(K) = C2
00121         K = K - 1
00122         FN = FN - 1.0E0
00123         IF (IFLAG.GE.3) GO TO 90
00124         C2R = REAL(C2)
00125         C2I = AIMAG(C2)
00126         C2R = ABS(C2R)
00127         C2I = ABS(C2I)
00128         C2M = AMAX1(C2R,C2I)
00129         IF (C2M.LE.ASCLE) GO TO 90
00130         IFLAG = IFLAG + 1
00131         ASCLE = BRY(IFLAG)
00132         S1 = S1*C1
00133         S2 = C2
00134         S1 = S1*CSS(IFLAG)
00135         S2 = S2*CSS(IFLAG)
00136         C1 = CSR(IFLAG)
00137    90 CONTINUE
00138   100 CONTINUE
00139       RETURN
00140 C-----------------------------------------------------------------------
00141 C     SET UNDERFLOW AND UPDATE PARAMETERS
00142 C-----------------------------------------------------------------------
00143   110 CONTINUE
00144       IF (RS1.GT.0.0E0) GO TO 120
00145       Y(ND) = CZERO
00146       NZ = NZ + 1
00147       ND = ND - 1
00148       IF (ND.EQ.0) GO TO 100
00149       CALL CUOIK(Z, FNU, KODE, 1, ND, Y, NUF, TOL, ELIM, ALIM)
00150       IF (NUF.LT.0) GO TO 120
00151       ND = ND - NUF
00152       NZ = NZ + NUF
00153       IF (ND.EQ.0) GO TO 100
00154       FN = FNU + FLOAT(ND-1)
00155       IF (FN.GE.FNUL) GO TO 30
00156       NLAST = ND
00157       RETURN
00158   120 CONTINUE
00159       NZ = -1
00160       RETURN
00161   130 CONTINUE
00162       IF (RS1.GT.0.0E0) GO TO 120
00163       NZ = N
00164       DO 140 I=1,N
00165         Y(I) = CZERO
00166   140 CONTINUE
00167       RETURN
00168       END
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines