rfftf.f 3.8 KB

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