]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MINICERN/mathlib/gen/c/r7dp.F
Changes needed by ICC/IFC compiler (Intel)
[u/mrichter/AliRoot.git] / MINICERN / mathlib / gen / c / r7dp.F
CommitLineData
fe4da5cc 1*
2* $Id$
3*
4* $Log$
5* Revision 1.1.1.1 1996/04/01 15:01:57 mclareni
6* Mathlib gen
7*
8*
9#include "gen/pilot.h"
10#if defined(CERNLIB_DOUBLE)
11 SUBROUTINE C309R7(A,B,IBEG,INUM,XX,EPS)
12C
13C*******************************************************************
14C
15C RCF converts polynomial A to the corresponding continued
16C fraction, in 'normal' form with coefficients B
17C by the 'P algorithm' of Patry & Gupta
18C
19C A(z) = A1/z + A2/z**3 + A3/z**5 + ... + An/z**(2n-1)
20C
21C B(z) = B1/z+ B2/z+ B3/z+ .../(z+ Bn/z)
22C
23C data:
24C A vector A(k), k=1,INUM input
25C B vector B(k), k=IBEG,INUM output
26C IBEG order of first coef. calc. input
27C INUM order of A, even or odd input
28C XX auxiliary vector of length .ge. length of vector B
29C caller provides space for A,B,XX
30C Note that neither of the first two terms A(1) A(2) should be zero
31C & the user can start the calculation with any value of
32C IBEG provided the c.f. coefs have been already
33C calculated up to INUM = IBEG-1
34C & the method breaks down as soon as the absolute value
35C of a c.f. coef. is less than EPS. At the time of the
36C break up INUM has been replaced by minus times the number
37C of this coefficient.
38C algorithm: J. Patry & S. Gupta, EIR-Bericht 247, November 1973
39C Eidg. Institut fur Reaktorforschung
40C Wuerenlingen, Switzerland
41C see also: Haenggi, Roesel & Trautmann,
42C J. Comput. Phys., v. 137, (1980) 242-258
43C note: restart procedure modified by I.J.Thompson
44C
45C*******************************************************************
46C
47 IMPLICIT COMPLEX*16(A-H,O-Z)
48 DIMENSION A(100),B(100),XX(2,100)
49 LOGICAL EVEN
50 DOUBLE PRECISION EPS
51
52 IBN=INUM
53 IF(IBEG .GT. 4) GO TO 50
54 IF(IBEG .EQ. 4) GO TO 20
55 B(1)=A(1)
56 IF(IBN .GE. 2) B(2)=-A(2)/A(1)
57 IF(IBN .LT. 3) RETURN
58 X0=A(3)/A(2)
59 XX(2,1)=B(2)
60 XX(1,1)=-X0
61 XX(1,2)=0
62 B(3)=-X0-B(2)
63 X0=-B(3)*A(2)
64 M=3
65 MP12=2
66 EVEN=.TRUE.
67 IF(IBN .LE. 3) RETURN
68 20 IF(ABS(B(3)) .LT. EPS*ABS(X0)) THEN
69 INUM=-M
70 RETURN
71 END IF
72 M=4
73 30 X1=A(M)
74 M2M1=MP12
75 MP12=M2M1+1
76 IF(EVEN) MP12=M2M1
77 DO 40 K = 2,MP12
78 40 X1=X1+A(M-K+1)*XX(1,K-1)
79 B(M)=-X1/X0
80 IF(M .GE. IBN) RETURN
81 50 IF(ABS(B(M)) .LT. EPS*ABS(X0)) THEN
82 INUM=-M
83 RETURN
84 END IF
85 DO 60 K = M2M1,2,-1
86 60 XX(2,K)=XX(1,K)+B(M)*XX(2,K-1)
87 XX(2,1)=XX(1,1)+B(M)
88 DO 70 K = 1,M2M1
89 X0=XX(2,K)
90 XX(2,K)=XX(1,K)
91 70 XX(1,K)=X0
92 X0=X1
93 XX(1,M2M1+1)=0
94 M=M+1
95 EVEN=.NOT.EVEN
96 GO TO 30
97 END
98#endif