cacon.f

Go to the documentation of this file.
00001       SUBROUTINE CACON(Z, FNU, KODE, MR, N, Y, NZ, RL, FNUL, TOL, ELIM,
00002      * ALIM)
00003 C***BEGIN PROLOGUE  CACON
00004 C***REFER TO  CBESK,CBESH
00005 C
00006 C     CACON APPLIES THE ANALYTIC CONTINUATION FORMULA
00007 C
00008 C         K(FNU,ZN*EXP(MP))=K(FNU,ZN)*EXP(-MP*FNU) - MP*I(FNU,ZN)
00009 C                 MP=PI*MR*CMPLX(0.0,1.0)
00010 C
00011 C     TO CONTINUE THE K FUNCTION FROM THE RIGHT HALF TO THE LEFT
00012 C     HALF Z PLANE
00013 C
00014 C***ROUTINES CALLED  CBINU,CBKNU,CS1S2,R1MACH
00015 C***END PROLOGUE  CACON
00016       COMPLEX CK, CONE, CS, CSCL, CSCR, CSGN, CSPN, CSS, CSR, C1, C2,
00017      * RZ, SC1, SC2, ST, S1, S2, Y, Z, ZN, CY
00018       REAL ALIM, ARG, ASCLE, AS2, BSCLE, BRY, CPN, C1I, C1M, C1R, ELIM,
00019      * FMR, FNU, FNUL, PI, RL, SGN, SPN, TOL, YY, R1MACH
00020       INTEGER I, INU, IUF, KFLAG, KODE, MR, N, NN, NW, NZ
00021       DIMENSION Y(N), CY(2), CSS(3), CSR(3), BRY(3)
00022       DATA PI / 3.14159265358979324E0 /
00023       DATA CONE / (1.0E0,0.0E0) /
00024       NZ = 0
00025       ZN = -Z
00026       NN = N
00027       CALL CBINU(ZN, FNU, KODE, NN, Y, NW, RL, FNUL, TOL, ELIM, ALIM)
00028       IF (NW.LT.0) GO TO 80
00029 C-----------------------------------------------------------------------
00030 C     ANALYTIC CONTINUATION TO THE LEFT HALF PLANE FOR THE K FUNCTION
00031 C-----------------------------------------------------------------------
00032       NN = MIN0(2,N)
00033       CALL CBKNU(ZN, FNU, KODE, NN, CY, NW, TOL, ELIM, ALIM)
00034       IF (NW.NE.0) GO TO 80
00035       S1 = CY(1)
00036       FMR = FLOAT(MR)
00037       SGN = -SIGN(PI,FMR)
00038       CSGN = CMPLX(0.0E0,SGN)
00039       IF (KODE.EQ.1) GO TO 10
00040       YY = -AIMAG(ZN)
00041       CPN = COS(YY)
00042       SPN = SIN(YY)
00043       CSGN = CSGN*CMPLX(CPN,SPN)
00044    10 CONTINUE
00045 C-----------------------------------------------------------------------
00046 C     CALCULATE CSPN=EXP(FNU*PI*I) TO MINIMIZE LOSSES OF SIGNIFICANCE
00047 C     WHEN FNU IS LARGE
00048 C-----------------------------------------------------------------------
00049       INU = INT(FNU)
00050       ARG = (FNU-FLOAT(INU))*SGN
00051       CPN = COS(ARG)
00052       SPN = SIN(ARG)
00053       CSPN = CMPLX(CPN,SPN)
00054       IF (MOD(INU,2).EQ.1) CSPN = -CSPN
00055       IUF = 0
00056       C1 = S1
00057       C2 = Y(1)
00058       ASCLE = 1.0E+3*R1MACH(1)/TOL
00059       IF (KODE.EQ.1) GO TO 20
00060       CALL CS1S2(ZN, C1, C2, NW, ASCLE, ALIM, IUF)
00061       NZ = NZ + NW
00062       SC1 = C1
00063    20 CONTINUE
00064       Y(1) = CSPN*C1 + CSGN*C2
00065       IF (N.EQ.1) RETURN
00066       CSPN = -CSPN
00067       S2 = CY(2)
00068       C1 = S2
00069       C2 = Y(2)
00070       IF (KODE.EQ.1) GO TO 30
00071       CALL CS1S2(ZN, C1, C2, NW, ASCLE, ALIM, IUF)
00072       NZ = NZ + NW
00073       SC2 = C1
00074    30 CONTINUE
00075       Y(2) = CSPN*C1 + CSGN*C2
00076       IF (N.EQ.2) RETURN
00077       CSPN = -CSPN
00078       RZ = CMPLX(2.0E0,0.0E0)/ZN
00079       CK = CMPLX(FNU+1.0E0,0.0E0)*RZ
00080 C-----------------------------------------------------------------------
00081 C     SCALE NEAR EXPONENT EXTREMES DURING RECURRENCE ON K FUNCTIONS
00082 C-----------------------------------------------------------------------
00083       CSCL = CMPLX(1.0E0/TOL,0.0E0)
00084       CSCR = CMPLX(TOL,0.0E0)
00085       CSS(1) = CSCL
00086       CSS(2) = CONE
00087       CSS(3) = CSCR
00088       CSR(1) = CSCR
00089       CSR(2) = CONE
00090       CSR(3) = CSCL
00091       BRY(1) = ASCLE
00092       BRY(2) = 1.0E0/ASCLE
00093       BRY(3) = R1MACH(2)
00094       AS2 = CABS(S2)
00095       KFLAG = 2
00096       IF (AS2.GT.BRY(1)) GO TO 40
00097       KFLAG = 1
00098       GO TO 50
00099    40 CONTINUE
00100       IF (AS2.LT.BRY(2)) GO TO 50
00101       KFLAG = 3
00102    50 CONTINUE
00103       BSCLE = BRY(KFLAG)
00104       S1 = S1*CSS(KFLAG)
00105       S2 = S2*CSS(KFLAG)
00106       CS = CSR(KFLAG)
00107       DO 70 I=3,N
00108         ST = S2
00109         S2 = CK*S2 + S1
00110         S1 = ST
00111         C1 = S2*CS
00112         ST = C1
00113         C2 = Y(I)
00114         IF (KODE.EQ.1) GO TO 60
00115         IF (IUF.LT.0) GO TO 60
00116         CALL CS1S2(ZN, C1, C2, NW, ASCLE, ALIM, IUF)
00117         NZ = NZ + NW
00118         SC1 = SC2
00119         SC2 = C1
00120         IF (IUF.NE.3) GO TO 60
00121         IUF = -4
00122         S1 = SC1*CSS(KFLAG)
00123         S2 = SC2*CSS(KFLAG)
00124         ST = SC2
00125    60   CONTINUE
00126         Y(I) = CSPN*C1 + CSGN*C2
00127         CK = CK + RZ
00128         CSPN = -CSPN
00129         IF (KFLAG.GE.3) GO TO 70
00130         C1R = REAL(C1)
00131         C1I = AIMAG(C1)
00132         C1R = ABS(C1R)
00133         C1I = ABS(C1I)
00134         C1M = AMAX1(C1R,C1I)
00135         IF (C1M.LE.BSCLE) GO TO 70
00136         KFLAG = KFLAG + 1
00137         BSCLE = BRY(KFLAG)
00138         S1 = S1*CS
00139         S2 = ST
00140         S1 = S1*CSS(KFLAG)
00141         S2 = S2*CSS(KFLAG)
00142         CS = CSR(KFLAG)
00143    70 CONTINUE
00144       RETURN
00145    80 CONTINUE
00146       NZ = -1
00147       IF(NW.EQ.(-2)) NZ=-2
00148       RETURN
00149       END
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines