* PACKAGE TCFOUR    !" $B%F%9%H(B : $B%U!<%j%(JQ49(B
*
*"  [HIS] 95/08/09 (takepiro) 
*
***********************************************************************
      PROGRAM TCFOUR
*
      INTEGER  N, KDIM, KMAX
      PARAMETER ( N = 8 , KDIM = 1, KMAX = 1 )
*
      REAL WTBL( 2, N )
      REAL DATA( KDIM, 2, N )      !" $B%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
            DATA( K, 1, I ) = COS( 2*MWAVE*PI*(I-1)/REAL(N) ) !" $B<B?tIt(B
            DATA( K, 2, I ) = 0                               !" $B5u?tIt(B
 1000 CONTINUE 
*
      DO 1100 K = 1, KDIM
         WRITE ( 6, * ) ' Before FFT Transformation : k =', K
         WRITE ( 6, '(8F9.3)' ) ( DATA(K,1,I) , I=1, N)
         WRITE ( 6, '(8F9.3)' ) ( DATA(K,2,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 CFOURT   !" FFT $BJ#AG?t(B, $B4p?t(B 2
     M         ( DATA  ,
     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)' ) ( DATA(K,1,I) , I=1, N)
         WRITE ( 6, '(8F9.3)' ) ( DATA(K,2,I) , I=1, N)
 1400 CONTINUE 
*
*"     < 5. $B%U!<%j%(5UJQ49(B >
*
      CALL CFOURT   !" FFT $BJ#AG?t(B, $B4p?t(B 2
     M         ( DATA  ,
     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)' ) ( DATA(K,1,I)/N , I=1, N)
         WRITE ( 6, '(8F9.3)' ) ( DATA(K,2,I)/N , I=1, N)
 1600 CONTINUE 

      STOP
      END


