rfftb.f 3.8 KB

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