* PACKAGE TRFOUR    !" $B%F%9%H(B : $B%U!<%j%(JQ49(B
*
*"  [HIS] 95/08/09 (takepiro) 
*
***********************************************************************
      PROGRAM TRFOUR
*
      INTEGER  N, KDIM, KMAX
      PARAMETER ( N = 8 , KDIM = 1, KMAX = 1 )
*
      REAL WTBL( 2, N )
      REAL DATAO( KDIM, N )      !" $B=PNO%G!<%?(B
      REAL DATAI( KDIM, N )      !" $BF~NO%G!<%?(B
      INTEGER IFAC
      REAL PI
      INTEGER K, I
*
      INTEGER MWAVE
*
      PI = 4 * ATAN(1.0D0)
*
*"     < 1. $B%G!<%?@_Dj(B >
*
      WRITE ( 6, * ) ' MWAVE?' 
      READ( 5, * ) MWAVE
      DO 1000 K = 1, KDIM
         DO 1000 I = 1, N
            DATAI( K, I ) = COS( 2*MWAVE*PI*(I-1)/REAL(N) )  
c$$$            DATAI( K, I ) = SIN( 2*MWAVE*PI*(I-1)/REAL(N) )  
 1000 CONTINUE 
*
      DO 1100 K = 1, KDIM
         WRITE ( 6, * ) ' Before FFT Transformation : k =', K
         WRITE ( 6, '(8F9.3)' ) ( DATAI(K,I) , I=1, N)
 1100 CONTINUE 
*
*"     < 2. $B;03Q4X?tI=:n@.(B >
*
      CALL RFFTIM     !" FFT 3$B3Q4X?tI=:n@.(B
     I         ( N     ,
     O           WTBL  , IFAC  )
*
*"     < 3. $B%U!<%j%(@5JQ49(B >
*
      CALL RFOURT   !" FFT $BJ#AG?t(B, $B4p?t(B 2
     O         ( DATAO  ,
     M           DATAI  ,
     F           1 ,
     I           WTBL  ,
     D           N     , KMAX  , KDIM )
*
*"     < 4. $B=PNO(B >
*
      DO 1400 K = 1, KDIM
         WRITE ( 6, * ) ' FFT Transformation : k =', K
         WRITE ( 6, '(8F9.3)' ) ( DATAO(K,I) , I=1, N)
 1400 CONTINUE 
*
*"     < 5. $B%U!<%j%(5UJQ49(B >
*
      CALL RFOURT   !" FFT $BJ#AG?t(B, $B4p?t(B 2
     O         ( DATAI  ,
     M           DATAO  ,
     F           -1 ,
     I           WTBL  ,
     D           N     , KMAX  , KDIM )
*
*"     < 6. $B=PNO(B >
*
      DO 1600 K = 1, KDIM
         WRITE ( 6, * ) ' Inverse FFT Transformation : k =', K
         WRITE ( 6, '(8F9.3)' ) ( DATAI(K,I) , I=1, N)
 1600 CONTINUE 

      STOP
      END


