sinqb.f 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. *DECK SINQB
  2. SUBROUTINE SINQB (N, X, WSAVE)
  3. C***BEGIN PROLOGUE SINQB
  4. C***PURPOSE Compute the unnormalized inverse of SINQF.
  5. C***LIBRARY SLATEC (FFTPACK)
  6. C***CATEGORY J1A3
  7. C***TYPE SINGLE PRECISION (SINQB-S)
  8. C***KEYWORDS FFTPACK, FOURIER TRANSFORM
  9. C***AUTHOR Swarztrauber, P. N., (NCAR)
  10. C***DESCRIPTION
  11. C
  12. C Subroutine SINQB computes the fast Fourier transform of quarter
  13. C wave data. That is, SINQB computes a sequence from its
  14. C representation in terms of a sine series with odd wave numbers.
  15. C the transform is defined below at output parameter X.
  16. C
  17. C SINQF is the unnormalized inverse of SINQB since a call of SINQB
  18. C followed by a call of SINQF will multiply the input sequence X
  19. C by 4*N.
  20. C
  21. C The array WSAVE which is used by subroutine SINQB must be
  22. C initialized by calling subroutine SINQI(N,WSAVE).
  23. C
  24. C Input Parameters
  25. C
  26. C N the length of the array X to be transformed. The method
  27. C is most efficient when N is a product of small primes.
  28. C
  29. C X an array which contains the sequence to be transformed
  30. C
  31. C WSAVE a work array which must be dimensioned at least 3*N+15
  32. C in the program that calls SINQB. The WSAVE array must be
  33. C initialized by calling subroutine SINQI(N,WSAVE), and a
  34. C different WSAVE array must be used for each different
  35. C value of N. This initialization does not have to be
  36. C repeated so long as N remains unchanged. Thus subsequent
  37. C transforms can be obtained faster than the first.
  38. C
  39. C Output Parameters
  40. C
  41. C X For I=1,...,N
  42. C
  43. C X(I)= the sum from K=1 to K=N of
  44. C
  45. C 4*X(K)*SIN((2*K-1)*I*PI/(2*N))
  46. C
  47. C a call of SINQB followed by a call of
  48. C SINQF will multiply the sequence X by 4*N.
  49. C Therefore SINQF is the unnormalized inverse
  50. C of SINQB.
  51. C
  52. C WSAVE contains initialization calculations which must not
  53. C be destroyed between calls of SINQB or SINQF.
  54. C
  55. C***REFERENCES P. N. Swarztrauber, Vectorizing the FFTs, in Parallel
  56. C Computations (G. Rodrigue, ed.), Academic Press,
  57. C 1982, pp. 51-83.
  58. C***ROUTINES CALLED COSQB
  59. C***REVISION HISTORY (YYMMDD)
  60. C 790601 DATE WRITTEN
  61. C 830401 Modified to use SLATEC library source file format.
  62. C 860115 Modified by Ron Boisvert to adhere to Fortran 77 by
  63. C changing dummy array size declarations (1) to (*).
  64. C 861211 REVISION DATE from Version 3.2
  65. C 881128 Modified by Dick Valent to meet prologue standards.
  66. C 891214 Prologue converted to Version 4.0 format. (BAB)
  67. C 920501 Reformatted the REFERENCES section. (WRB)
  68. C***END PROLOGUE SINQB
  69. DIMENSION X(*), WSAVE(*)
  70. C***FIRST EXECUTABLE STATEMENT SINQB
  71. IF (N .GT. 1) GO TO 101
  72. X(1) = 4.*X(1)
  73. RETURN
  74. 101 NS2 = N/2
  75. DO 102 K=2,N,2
  76. X(K) = -X(K)
  77. 102 CONTINUE
  78. CALL COSQB (N,X,WSAVE)
  79. DO 103 K=1,NS2
  80. KC = N-K
  81. XHOLD = X(K)
  82. X(K) = X(KC+1)
  83. X(KC+1) = XHOLD
  84. 103 CONTINUE
  85. RETURN
  86. END