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: cosqb1.f,v 1.2 2004/06/15 21:14:57 rodney Exp $ |
---|
11 | ! |
---|
12 | !CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
13 | |
---|
14 | SUBROUTINE COSQB1 (N,INC,X,WSAVE,WORK,IER) |
---|
15 | DIMENSION X(INC,*) ,WSAVE(*) ,WORK(*) |
---|
16 | IER = 0 |
---|
17 | NS2 = (N+1)/2 |
---|
18 | NP2 = N+2 |
---|
19 | DO 101 I=3,N,2 |
---|
20 | XIM1 = X(1,I-1)+X(1,I) |
---|
21 | X(1,I) = .5*(X(1,I-1)-X(1,I)) |
---|
22 | X(1,I-1) = .5*XIM1 |
---|
23 | 101 END DO |
---|
24 | X(1,1) = .5*X(1,1) |
---|
25 | MODN = MOD(N,2) |
---|
26 | IF (MODN .NE. 0) GO TO 302 |
---|
27 | X(1,N) = .5*X(1,N) |
---|
28 | 302 LENX = INC*(N-1) + 1 |
---|
29 | LNSV = N + INT(LOG(REAL(N))) + 4 |
---|
30 | LNWK = N |
---|
31 | ! |
---|
32 | CALL RFFT1B(N,INC,X,LENX,WSAVE(N+1),LNSV,WORK,LNWK,IER1) |
---|
33 | IF (IER1 .NE. 0) THEN |
---|
34 | IER = 20 |
---|
35 | CALL XERFFT ('COSQB1',-5) |
---|
36 | GO TO 400 |
---|
37 | ENDIF |
---|
38 | ! |
---|
39 | DO 102 K=2,NS2 |
---|
40 | KC = NP2-K |
---|
41 | WORK(K) = WSAVE(K-1)*X(1,KC)+WSAVE(KC-1)*X(1,K) |
---|
42 | WORK(KC) = WSAVE(K-1)*X(1,K)-WSAVE(KC-1)*X(1,KC) |
---|
43 | 102 END DO |
---|
44 | IF (MODN .NE. 0) GO TO 305 |
---|
45 | X(1,NS2+1) = WSAVE(NS2)*(X(1,NS2+1)+X(1,NS2+1)) |
---|
46 | 305 DO 103 K=2,NS2 |
---|
47 | KC = NP2-K |
---|
48 | X(1,K) = WORK(K)+WORK(KC) |
---|
49 | X(1,KC) = WORK(K)-WORK(KC) |
---|
50 | 103 END DO |
---|
51 | X(1,1) = X(1,1)+X(1,1) |
---|
52 | 400 RETURN |
---|
53 | END |
---|