2 SUBROUTINE RFFTF1 (N, C, CH, WA, IFAC)
3 C***BEGIN PROLOGUE RFFTF1
4 C***PURPOSE Compute the forward transform of a real, periodic sequence.
5 C***LIBRARY SLATEC (FFTPACK)
7 C***TYPE SINGLE PRECISION (RFFTF1-S, CFFTF1-C)
8 C***KEYWORDS FFTPACK, FOURIER TRANSFORM
9 C***AUTHOR Swarztrauber, P. N., (NCAR)
12 C Subroutine RFFTF1 computes the Fourier coefficients of a real
13 C periodic sequence (Fourier analysis). The transform is defined
14 C below at output parameter C.
16 C The arrays WA and IFAC which are used by subroutine RFFTB1 must be
17 C initialized by calling subroutine RFFTI1.
21 C N the length of the array R to be transformed. The method
22 C is most efficient when N is a product of small primes.
23 C N may change so long as different work arrays are provided.
25 C C a real array of length N which contains the sequence
28 C CH a real work array of length at least N.
30 C WA a real work array which must be dimensioned at least N.
32 C IFAC an integer work array which must be dimensioned at least 15.
34 C The WA and IFAC arrays must be initialized by calling
35 C subroutine RFFTI1, and different WA and IFAC arrays must be
36 C used for each different value of N. This initialization
37 C does not have to be repeated so long as N remains unchanged.
38 C Thus subsequent transforms can be obtained faster than the
39 C first. The same WA and IFAC arrays can be used by RFFTF1
44 C C C(1) = the sum from I=1 to I=N of R(I)
46 C If N is even set L = N/2; if N is odd set L = (N+1)/2
48 C then for K = 2,...,L
50 C C(2*K-2) = the sum from I = 1 to I = N of
52 C C(I)*COS((K-1)*(I-1)*2*PI/N)
54 C C(2*K-1) = the sum from I = 1 to I = N of
56 C -C(I)*SIN((K-1)*(I-1)*2*PI/N)
60 C C(N) = the sum from I = 1 to I = N of
64 C Notes: This transform is unnormalized since a call of RFFTF1
65 C followed by a call of RFFTB1 will multiply the input
68 C WA and IFAC contain initialization calculations which must
69 C not be destroyed between calls of subroutine RFFTF1 or
72 C***REFERENCES P. N. Swarztrauber, Vectorizing the FFTs, in Parallel
73 C Computations (G. Rodrigue, ed.), Academic Press,
75 C***ROUTINES CALLED RADF2, RADF3, RADF4, RADF5, RADFG
76 C***REVISION HISTORY (YYMMDD)
78 C 830401 Modified to use SLATEC library source file format.
79 C 860115 Modified by Ron Boisvert to adhere to Fortran 77 by
80 C changing dummy array size declarations (1) to (*).
81 C 881128 Modified by Dick Valent to meet prologue standards.
82 C 891214 Prologue converted to Version 4.0 format. (BAB)
83 C 900131 Routine changed from subsidiary to user-callable. (WRB)
84 C 920501 Reformatted the REFERENCES section. (WRB)
85 C***END PROLOGUE RFFTF1
86 DIMENSION CH(*), C(*), WA(*), IFAC(*)
87 C***FIRST EXECUTABLE STATEMENT RFFTF1
100 IF (IP .NE. 4) GO TO 102
103 IF (NA .NE. 0) GO TO 101
104 CALL RADF4 (IDO,L1,C,CH,WA(IW),WA(IX2),WA(IX3))
106 101 CALL RADF4 (IDO,L1,CH,C,WA(IW),WA(IX2),WA(IX3))
108 102 IF (IP .NE. 2) GO TO 104
109 IF (NA .NE. 0) GO TO 103
110 CALL RADF2 (IDO,L1,C,CH,WA(IW))
112 103 CALL RADF2 (IDO,L1,CH,C,WA(IW))
114 104 IF (IP .NE. 3) GO TO 106
116 IF (NA .NE. 0) GO TO 105
117 CALL RADF3 (IDO,L1,C,CH,WA(IW),WA(IX2))
119 105 CALL RADF3 (IDO,L1,CH,C,WA(IW),WA(IX2))
121 106 IF (IP .NE. 5) GO TO 108
125 IF (NA .NE. 0) GO TO 107
126 CALL RADF5 (IDO,L1,C,CH,WA(IW),WA(IX2),WA(IX3),WA(IX4))
128 107 CALL RADF5 (IDO,L1,CH,C,WA(IW),WA(IX2),WA(IX3),WA(IX4))
130 108 IF (IDO .EQ. 1) NA = 1-NA
131 IF (NA .NE. 0) GO TO 109
132 CALL RADFG (IDO,IP,L1,IDL1,C,C,C,CH,CH,WA(IW))
135 109 CALL RADFG (IDO,IP,L1,IDL1,CH,CH,CH,C,C,WA(IW))
139 IF (NA .EQ. 1) RETURN