C ***********************************************************
C
C THIS PROGRAM GENERATES TWIDDLE FACTORS FOR A
C DATA A STATEMENT OF AN FFT PROGRAM.
C FILENAME IS "TWIDDLE.LIB"
C
C Written by Victor De Pinto
C Revised July 1981
C
      PROGRAM JENIFER
      DOUBLE PRECISION PI, A, A1, A2, A3, A4
      DATA PI, LFEED / 3.141592653590D+00, X'0A' /
      CALL OPEN (3, 'TWIDDLE LIB', 0)
      WRITE (3,10)
10    FORMAT ()
      DO 1 I=1,512,5
      I1=I+1
      I2=I+2
      I3=I+3
      I4=I+4
      A =DCOS( (I  )*(-PI/512.0D+00) )
      A1=DCOS( (I+1)*(-PI/512.0D+00) )
      A2=DCOS( (I+2)*(-PI/512.0D+00) )
      A3=DCOS( (I+3)*(-PI/512.0D+00) )
      A4=DCOS( (I+4)*(-PI/512.0D+00) )
      WRITE (3,2) LFEED,I,I1,I2,I3,I4
1     WRITE (3,3) LFEED,A,A1,A2,A3,A4
2     FORMAT (A1, '     X ', 5( ',W(1,', I3, ')' ), '/')
3     FORMAT (A1, '     X ', 4(F10.7, ','), F10.7, '/')
      DO 6 I=1,512,5
      I1=I+1
      I2=I+2
      I3=I+3
      I4=I+4
      A =DSIN( (I  )*(-PI/512.0D+00) )
      A1=DSIN( (I+1)*(-PI/512.0D+00) )
      A2=DSIN( (I+2)*(-PI/512.0D+00) )
      A3=DSIN( (I+3)*(-PI/512.0D+00) )
      A4=DSIN( (I+4)*(-PI/512.0D+00) )
      WRITE (3,7) LFEED,I,I1,I2,I3,I4
6     WRITE (3,8) LFEED,A,A1,A2,A3,A4
7     FORMAT (A1, '     X ', 5( ',W(2,', I3, ')' ), '/')
8     FORMAT (A1, '     X ', 4(F10.7, ','), F10.7, '/')
      ENDFILE 3
      END
