sinqf.f 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. *DECK SINQF
  2. SUBROUTINE SINQF (N, X, WSAVE)
  3. C***BEGIN PROLOGUE SINQF
  4. C***PURPOSE Compute the forward sine transform with odd wave numbers.
  5. C***LIBRARY SLATEC (FFTPACK)
  6. C***CATEGORY J1A3
  7. C***TYPE SINGLE PRECISION (SINQF-S)
  8. C***KEYWORDS FFTPACK, FOURIER TRANSFORM
  9. C***AUTHOR Swarztrauber, P. N., (NCAR)
  10. C***DESCRIPTION
  11. C
  12. C Subroutine SINQF computes the fast Fourier transform of quarter
  13. C wave data. That is, SINQF computes the coefficients in a sine
  14. C series representation with only odd wave numbers. The transform
  15. C is defined below at output parameter X.
  16. C
  17. C SINQB is the unnormalized inverse of SINQF since a call of SINQF
  18. C followed by a call of SINQB will multiply the input sequence X
  19. C by 4*N.
  20. C
  21. C The array WSAVE which is used by subroutine SINQF 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 SINQF. 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) = (-1)**(I-1)*X(N)
  44. C
  45. C + the sum from K=1 to K=N-1 of
  46. C
  47. C 2*X(K)*SIN((2*I-1)*K*PI/(2*N))
  48. C
  49. C A call of SINQF followed by a call of
  50. C SINQB will multiply the sequence X by 4*N.
  51. C Therefore SINQB is the unnormalized inverse
  52. C of SINQF.
  53. C
  54. C WSAVE contains initialization calculations which must not
  55. C be destroyed between calls of SINQF or SINQB.
  56. C
  57. C***REFERENCES P. N. Swarztrauber, Vectorizing the FFTs, in Parallel
  58. C Computations (G. Rodrigue, ed.), Academic Press,
  59. C 1982, pp. 51-83.
  60. C***ROUTINES CALLED COSQF
  61. C***REVISION HISTORY (YYMMDD)
  62. C 790601 DATE WRITTEN
  63. C 830401 Modified to use SLATEC library source file format.
  64. C 860115 Modified by Ron Boisvert to adhere to Fortran 77 by
  65. C changing dummy array size declarations (1) to (*)
  66. C 861211 REVISION DATE from Version 3.2
  67. C 881128 Modified by Dick Valent to meet prologue standards.
  68. C 891214 Prologue converted to Version 4.0 format. (BAB)
  69. C 920501 Reformatted the REFERENCES section. (WRB)
  70. C***END PROLOGUE SINQF
  71. DIMENSION X(*), WSAVE(*)
  72. C***FIRST EXECUTABLE STATEMENT SINQF
  73. IF (N .EQ. 1) RETURN
  74. NS2 = N/2
  75. DO 101 K=1,NS2
  76. KC = N-K
  77. XHOLD = X(K)
  78. X(K) = X(KC+1)
  79. X(KC+1) = XHOLD
  80. 101 CONTINUE
  81. CALL COSQF (N,X,WSAVE)
  82. DO 102 K=2,N,2
  83. X(K) = -X(K)
  84. 102 CONTINUE
  85. RETURN
  86. END