1 | !CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
2 | ! |
---|
3 | ! FFTPACK 5.0 |
---|
4 | ! Copyright (C) 1995-2004, Scientific Computing Division, |
---|
5 | ! University Corporation for Atmospheric Research |
---|
6 | ! Licensed under the GNU General Public License (GPL) |
---|
7 | ! |
---|
8 | ! Authors: Paul N. Swarztrauber and Richard A. Valent |
---|
9 | ! |
---|
10 | ! $Id: mcstb1.f,v 1.2 2004/06/15 21:29:19 rodney Exp $ |
---|
11 | ! |
---|
12 | !CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
13 | |
---|
14 | SUBROUTINE MCSTB1(LOT,JUMP,N,INC,X,WSAVE,DSUM,WORK,IER) |
---|
15 | REAL X(INC,*) ,WSAVE(*) |
---|
16 | DOUBLE PRECISION DSUM(*) |
---|
17 | IER = 0 |
---|
18 | NM1 = N-1 |
---|
19 | NP1 = N+1 |
---|
20 | NS2 = N/2 |
---|
21 | LJ = (LOT-1)*JUMP+1 |
---|
22 | IF (N-2) 106,101,102 |
---|
23 | 101 DO 111 M=1,LJ,JUMP |
---|
24 | X1H = X(M,1)+X(M,2) |
---|
25 | X(M,2) = X(M,1)-X(M,2) |
---|
26 | X(M,1) = X1H |
---|
27 | 111 END DO |
---|
28 | RETURN |
---|
29 | 102 IF (N .GT. 3) GO TO 103 |
---|
30 | DO 112 M=1,LJ,JUMP |
---|
31 | X1P3 = X(M,1)+X(M,3) |
---|
32 | X2 = X(M,2) |
---|
33 | X(M,2) = X(M,1)-X(M,3) |
---|
34 | X(M,1) = X1P3+X2 |
---|
35 | X(M,3) = X1P3-X2 |
---|
36 | 112 END DO |
---|
37 | RETURN |
---|
38 | 103 DO 118 M=1,LJ,JUMP |
---|
39 | X(M,1) = X(M,1)+X(M,1) |
---|
40 | X(M,N) = X(M,N)+X(M,N) |
---|
41 | 118 END DO |
---|
42 | M1 = 0 |
---|
43 | DO 113 M=1,LJ,JUMP |
---|
44 | M1 = M1+1 |
---|
45 | DSUM(M1) = X(M,1)-X(M,N) |
---|
46 | X(M,1) = X(M,1)+X(M,N) |
---|
47 | 113 END DO |
---|
48 | DO 104 K=2,NS2 |
---|
49 | M1 = 0 |
---|
50 | DO 114 M=1,LJ,JUMP |
---|
51 | M1 = M1+1 |
---|
52 | KC = NP1-K |
---|
53 | T1 = X(M,K)+X(M,KC) |
---|
54 | T2 = X(M,K)-X(M,KC) |
---|
55 | DSUM(M1) = DSUM(M1)+WSAVE(KC)*T2 |
---|
56 | T2 = WSAVE(K)*T2 |
---|
57 | X(M,K) = T1-T2 |
---|
58 | X(M,KC) = T1+T2 |
---|
59 | 114 CONTINUE |
---|
60 | 104 END DO |
---|
61 | MODN = MOD(N,2) |
---|
62 | IF (MODN .EQ. 0) GO TO 124 |
---|
63 | DO 123 M=1,LJ,JUMP |
---|
64 | X(M,NS2+1) = X(M,NS2+1)+X(M,NS2+1) |
---|
65 | 123 CONTINUE |
---|
66 | 124 CONTINUE |
---|
67 | LENX = (LOT-1)*JUMP + INC*(NM1-1) + 1 |
---|
68 | LNSV = NM1 + INT(LOG(REAL(NM1))) + 4 |
---|
69 | LNWK = LOT*NM1 |
---|
70 | ! |
---|
71 | CALL RFFTMF(LOT,JUMP,NM1,INC,X,LENX,WSAVE(N+1),LNSV,WORK, & |
---|
72 | & LNWK,IER1) |
---|
73 | IF (IER1 .NE. 0) THEN |
---|
74 | IER = 20 |
---|
75 | CALL XERFFT ('MCSTB1',-5) |
---|
76 | GO TO 106 |
---|
77 | ENDIF |
---|
78 | ! |
---|
79 | FNM1S2 = FLOAT(NM1)/2. |
---|
80 | M1 = 0 |
---|
81 | DO 10 M=1,LJ,JUMP |
---|
82 | M1 = M1+1 |
---|
83 | DSUM(M1) = .5*DSUM(M1) |
---|
84 | X(M,1) = FNM1S2*X(M,1) |
---|
85 | 10 END DO |
---|
86 | IF(MOD(NM1,2) .NE. 0) GO TO 30 |
---|
87 | DO 20 M=1,LJ,JUMP |
---|
88 | X(M,NM1) = X(M,NM1)+X(M,NM1) |
---|
89 | 20 END DO |
---|
90 | 30 FNM1S4 = FLOAT(NM1)/4. |
---|
91 | DO 105 I=3,N,2 |
---|
92 | M1 = 0 |
---|
93 | DO 115 M=1,LJ,JUMP |
---|
94 | M1 = M1+1 |
---|
95 | XI = FNM1S4*X(M,I) |
---|
96 | X(M,I) = FNM1S4*X(M,I-1) |
---|
97 | X(M,I-1) = DSUM(M1) |
---|
98 | DSUM(M1) = DSUM(M1)+XI |
---|
99 | 115 END DO |
---|
100 | 105 END DO |
---|
101 | IF (MODN .NE. 0) RETURN |
---|
102 | M1 = 0 |
---|
103 | DO 116 M=1,LJ,JUMP |
---|
104 | M1 = M1+1 |
---|
105 | X(M,N) = DSUM(M1) |
---|
106 | 116 END DO |
---|
107 | 106 CONTINUE |
---|
108 | RETURN |
---|
109 | END |
---|