costi.f 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. *DECK COSTI
  2. SUBROUTINE COSTI (N, WSAVE)
  3. C***BEGIN PROLOGUE COSTI
  4. C***PURPOSE Initialize a work array for COST.
  5. C***LIBRARY SLATEC (FFTPACK)
  6. C***CATEGORY J1A3
  7. C***TYPE SINGLE PRECISION (COSTI-S)
  8. C***KEYWORDS COSINE FOURIER TRANSFORM, FFTPACK
  9. C***AUTHOR Swarztrauber, P. N., (NCAR)
  10. C***DESCRIPTION
  11. C
  12. C Subroutine COSTI initializes the array WSAVE which is used in
  13. C subroutine COST. The prime factorization of N together with
  14. C a tabulation of the trigonometric functions are computed and
  15. C stored in WSAVE.
  16. C
  17. C Input Parameter
  18. C
  19. C N the length of the sequence to be transformed. The method
  20. C is most efficient when N-1 is a product of small primes.
  21. C
  22. C Output Parameter
  23. C
  24. C WSAVE a work array which must be dimensioned at least 3*N+15.
  25. C Different WSAVE arrays are required for different values
  26. C of N. The contents of WSAVE must not be changed between
  27. C calls of COST.
  28. C
  29. C***REFERENCES P. N. Swarztrauber, Vectorizing the FFTs, in Parallel
  30. C Computations (G. Rodrigue, ed.), Academic Press,
  31. C 1982, pp. 51-83.
  32. C***ROUTINES CALLED RFFTI
  33. C***REVISION HISTORY (YYMMDD)
  34. C 790601 DATE WRITTEN
  35. C 830401 Modified to use SLATEC library source file format.
  36. C 860115 Modified by Ron Boisvert to adhere to Fortran 77 by
  37. C (a) changing dummy array size declarations (1) to (*),
  38. C (b) changing references to intrinsic function FLOAT
  39. C to REAL, and
  40. C (c) changing definition of variable PI by using
  41. C FORTRAN intrinsic function ATAN instead of a DATA
  42. C statement.
  43. C 881128 Modified by Dick Valent to meet prologue standards.
  44. C 890531 Changed all specific intrinsics to generic. (WRB)
  45. C 890531 REVISION DATE from Version 3.2
  46. C 891214 Prologue converted to Version 4.0 format. (BAB)
  47. C 920501 Reformatted the REFERENCES section. (WRB)
  48. C***END PROLOGUE COSTI
  49. DIMENSION WSAVE(*)
  50. C***FIRST EXECUTABLE STATEMENT COSTI
  51. IF (N .LE. 3) RETURN
  52. PI = 4.*ATAN(1.)
  53. NM1 = N-1
  54. NP1 = N+1
  55. NS2 = N/2
  56. DT = PI/NM1
  57. FK = 0.
  58. DO 101 K=2,NS2
  59. KC = NP1-K
  60. FK = FK+1.
  61. WSAVE(K) = 2.*SIN(FK*DT)
  62. WSAVE(KC) = 2.*COS(FK*DT)
  63. 101 CONTINUE
  64. CALL RFFTI (NM1,WSAVE(N+1))
  65. RETURN
  66. END