[2759] | 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: mcstf1.f,v 1.2 2004/06/15 21:29:19 rodney Exp $ |
---|
| 11 | ! |
---|
| 12 | !CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
| 13 | |
---|
| 14 | SUBROUTINE MCSTF1(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) 200,101,102 |
---|
| 23 | 101 DO 111 M=1,LJ,JUMP |
---|
| 24 | X1H = X(M,1)+X(M,2) |
---|
| 25 | X(M,2) = .5*(X(M,1)-X(M,2)) |
---|
| 26 | X(M,1) = .5*X1H |
---|
| 27 | 111 END DO |
---|
| 28 | GO TO 200 |
---|
| 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 | TX2 = X(M,2)+X(M,2) |
---|
| 33 | X(M,2) = .5*(X(M,1)-X(M,3)) |
---|
| 34 | X(M,1) = .25*(X1P3+TX2) |
---|
| 35 | X(M,3) = .25*(X1P3-TX2) |
---|
| 36 | 112 END DO |
---|
| 37 | GO TO 200 |
---|
| 38 | 103 M1 = 0 |
---|
| 39 | DO 113 M=1,LJ,JUMP |
---|
| 40 | M1 = M1+1 |
---|
| 41 | DSUM(M1) = X(M,1)-X(M,N) |
---|
| 42 | X(M,1) = X(M,1)+X(M,N) |
---|
| 43 | 113 END DO |
---|
| 44 | DO 104 K=2,NS2 |
---|
| 45 | M1 = 0 |
---|
| 46 | DO 114 M=1,LJ,JUMP |
---|
| 47 | M1 = M1+1 |
---|
| 48 | KC = NP1-K |
---|
| 49 | T1 = X(M,K)+X(M,KC) |
---|
| 50 | T2 = X(M,K)-X(M,KC) |
---|
| 51 | DSUM(M1) = DSUM(M1)+WSAVE(KC)*T2 |
---|
| 52 | T2 = WSAVE(K)*T2 |
---|
| 53 | X(M,K) = T1-T2 |
---|
| 54 | X(M,KC) = T1+T2 |
---|
| 55 | 114 CONTINUE |
---|
| 56 | 104 END DO |
---|
| 57 | MODN = MOD(N,2) |
---|
| 58 | IF (MODN .EQ. 0) GO TO 124 |
---|
| 59 | DO 123 M=1,LJ,JUMP |
---|
| 60 | X(M,NS2+1) = X(M,NS2+1)+X(M,NS2+1) |
---|
| 61 | 123 CONTINUE |
---|
| 62 | 124 CONTINUE |
---|
| 63 | LENX = (LOT-1)*JUMP + INC*(NM1-1) + 1 |
---|
| 64 | LNSV = NM1 + INT(LOG(REAL(NM1))) + 4 |
---|
| 65 | LNWK = LOT*NM1 |
---|
| 66 | ! |
---|
| 67 | CALL RFFTMF(LOT,JUMP,NM1,INC,X,LENX,WSAVE(N+1),LNSV,WORK, & |
---|
| 68 | & LNWK,IER1) |
---|
| 69 | IF (IER1 .NE. 0) THEN |
---|
| 70 | IER = 20 |
---|
| 71 | CALL XERFFT ('MCSTF1',-5) |
---|
| 72 | GO TO 200 |
---|
| 73 | ENDIF |
---|
| 74 | ! |
---|
| 75 | SNM1 = 1./FLOAT(NM1) |
---|
| 76 | DO 10 M=1,LOT |
---|
| 77 | DSUM(M) = SNM1*DSUM(M) |
---|
| 78 | 10 END DO |
---|
| 79 | IF(MOD(NM1,2) .NE. 0) GO TO 30 |
---|
| 80 | DO 20 M=1,LJ,JUMP |
---|
| 81 | X(M,NM1) = X(M,NM1)+X(M,NM1) |
---|
| 82 | 20 END DO |
---|
| 83 | 30 DO 105 I=3,N,2 |
---|
| 84 | M1 = 0 |
---|
| 85 | DO 115 M=1,LJ,JUMP |
---|
| 86 | M1 = M1+1 |
---|
| 87 | XI = .5*X(M,I) |
---|
| 88 | X(M,I) = .5*X(M,I-1) |
---|
| 89 | X(M,I-1) = DSUM(M1) |
---|
| 90 | DSUM(M1) = DSUM(M1)+XI |
---|
| 91 | 115 END DO |
---|
| 92 | 105 END DO |
---|
| 93 | IF (MODN .NE. 0) GO TO 117 |
---|
| 94 | M1 = 0 |
---|
| 95 | DO 116 M=1,LJ,JUMP |
---|
| 96 | M1 = M1+1 |
---|
| 97 | X(M,N) = DSUM(M1) |
---|
| 98 | 116 END DO |
---|
| 99 | 117 DO 118 M=1,LJ,JUMP |
---|
| 100 | X(M,1) = .5*X(M,1) |
---|
| 101 | X(M,N) = .5*X(M,N) |
---|
| 102 | 118 END DO |
---|
| 103 | ! |
---|
| 104 | 200 CONTINUE |
---|
| 105 | RETURN |
---|
| 106 | END |
---|