cfftf.f 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. *DECK CFFTF
  2. SUBROUTINE CFFTF (N, C, WSAVE)
  3. C***BEGIN PROLOGUE CFFTF
  4. C***SUBSIDIARY
  5. C***PURPOSE Compute the forward transform of a complex, periodic
  6. C sequence.
  7. C***LIBRARY SLATEC (FFTPACK)
  8. C***CATEGORY J1A2
  9. C***TYPE COMPLEX (RFFTF-S, CFFTF-C)
  10. C***KEYWORDS FFTPACK, FOURIER TRANSFORM
  11. C***AUTHOR Swarztrauber, P. N., (NCAR)
  12. C***DESCRIPTION
  13. C
  14. C ********************************************************************
  15. C * NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE *
  16. C ********************************************************************
  17. C * *
  18. C * This routine uses non-standard Fortran 77 constructs and will *
  19. C * be removed from the library at a future date. You are *
  20. C * requested to use CFFTF1. *
  21. C * *
  22. C ********************************************************************
  23. C
  24. C Subroutine CFFTF computes the forward complex discrete Fourier
  25. C transform (the Fourier analysis). Equivalently, CFFTF computes
  26. C the Fourier coefficients of a complex periodic sequence.
  27. C The transform is defined below at output parameter C.
  28. C
  29. C The transform is not normalized. To obtain a normalized transform
  30. C the output must be divided by N. Otherwise a call of CFFTF
  31. C followed by a call of CFFTB will multiply the sequence by N.
  32. C
  33. C The array WSAVE which is used by subroutine CFFTF must be
  34. C initialized by calling subroutine CFFTI(N,WSAVE).
  35. C
  36. C Input Parameters
  37. C
  38. C N the length of the complex sequence C. The method is
  39. C more efficient when N is the product of small primes.
  40. C
  41. C C a complex array of length N which contains the sequence
  42. C
  43. C WSAVE a real work array which must be dimensioned at least 4*N+15
  44. C in the program that calls CFFTF. The WSAVE array must be
  45. C initialized by calling subroutine CFFTI(N,WSAVE), and a
  46. C different WSAVE array must be used for each different
  47. C value of N. This initialization does not have to be
  48. C repeated so long as N remains unchanged. Thus subsequent
  49. C transforms can be obtained faster than the first.
  50. C The same WSAVE array can be used by CFFTF and CFFTB.
  51. C
  52. C Output Parameters
  53. C
  54. C C For J=1,...,N
  55. C
  56. C C(J)=the sum from K=1,...,N of
  57. C
  58. C C(K)*EXP(-I*(J-1)*(K-1)*2*PI/N)
  59. C
  60. C where I=SQRT(-1)
  61. C
  62. C WSAVE contains initialization calculations which must not be
  63. C destroyed between calls of subroutine CFFTF or CFFTB
  64. C
  65. C***REFERENCES P. N. Swarztrauber, Vectorizing the FFTs, in Parallel
  66. C Computations (G. Rodrigue, ed.), Academic Press,
  67. C 1982, pp. 51-83.
  68. C***ROUTINES CALLED CFFTF1
  69. C***REVISION HISTORY (YYMMDD)
  70. C 790601 DATE WRITTEN
  71. C 830401 Modified to use SLATEC library source file format.
  72. C 860115 Modified by Ron Boisvert to adhere to Fortran 77 by
  73. C changing dummy array size declarations (1) to (*).
  74. C 861211 REVISION DATE from Version 3.2
  75. C 881128 Modified by Dick Valent to meet prologue standards.
  76. C 891214 Prologue converted to Version 4.0 format. (BAB)
  77. C 900131 Routine changed from user-callable to subsidiary
  78. C because of non-standard Fortran 77 arguments in the
  79. C call to CFFTB1. (WRB)
  80. C 920501 Reformatted the REFERENCES section. (WRB)
  81. C***END PROLOGUE CFFTF
  82. COMPLEX C
  83. DIMENSION C(*), WSAVE(*)
  84. C***FIRST EXECUTABLE STATEMENT CFFTF
  85. IF (N .EQ. 1) RETURN
  86. IW1 = N+N+1
  87. IW2 = IW1+N+N
  88. CALL CFFTF1 (N,C,WSAVE,WSAVE(IW1),WSAVE(IW2))
  89. RETURN
  90. END