      PROGRAM CDFTC1T                                                           
C                                                                               
C   MODULE        TEST CDFTC10                                                  
C   VERSION       1.0                                                           
C   LAST MODIFIED 23/10/81                                                      
C   AUTHOR        DAVE POWELL                                                   
C   ---------------------------------------------------------------             
C   PROGRAM TO TEST CDFTC10                                                     
C                                                                               
C   ---------------------------------------------------------------             
C                                                                               
C                                                                               
      REAL*4 PI,SRSIG(128),SISIG(128),SSR(64),SSI(64)                           
      INTEGER*4 I6,I7,I8,I9,K                                                   
      COMPLEX COMSIG(128)                                                       
      DATA PI/3.141592653589793/                                                
C                                                                               
C   (1) SET UP PROGRAM NAME AND ERROR THRESHOLDS                                
C   ********************************************                                
C                                                                               
      CALL UERSET('CDFTC1T','W','E','F')                                        
      CALL UERLU(7)                                                             
C                                                                               
C   (2) TEST(1):CALL SUBROUTINE WITH ONE SAMPLE                                 
C   *******************************************                                 
C                                                                               
      WRITE(7,2000)                                                             
      CALL CDFTC(1,COMSIG,4)                                                    
      CALL UERREP('FFTTEST',1,.FALSE.)                                          
      CALL UERCLR                                                               
      WRITE(7,2001)                                                             
C                                                                               
C   (3) TEST(2):CALL SUBROUTINE WITH 4096 SAMPLES                               
C   *********************************************                               
C                                                                               
      WRITE(7,3000)                                                             
      CALL CDFTC(4096,COMSIG,4)                                                 
      CALL UERREP('FFTTEST',2,.FALSE.)                                          
      CALL UERCLR                                                               
      WRITE(7,3001)                                                             
C                                                                               
C   (4) TEST(3):CALL SUBROUTINE WITH IOPT OUT OF RANGE                          
C   **************************************************                          
C                                                                               
      WRITE(7,4000)                                                             
      CALL CDFTC(16,COMSIG,9)                                                   
      CALL UERREP('FFTTEST',3,.FALSE.)                                          
      CALL UERCLR                                                               
      WRITE(7,4001)                                                             
C                                                                               
C                                                                               
C  (5) SET UP PARAMETERS                                                        
C  *********************                                                        
C                                                                               
      N=128                                                                     
C                                                                               
C                                                                               
C   (6) CALL SUBROUTINE WITH DIFFERENT OPTIONS                                  
C   ******************************************                                  
C                                                                               
      WRITE(7,6003)                                                             
      DO 6000 I7=1,3,2                                                          
          IOPT=I7+4                                                             
          CALL CSINGEN(N,SRSIG,SISIG,COMSIG)                                    
C                                                                               
          CALL CDFTC(N,COMSIG,IOPT)                                             
          CALL UERREP('FFTTEST',4,.FALSE.)                                      
          CALL UERCLR                                                           
C                                                                               
          WRITE(7,6001)IOPT                                                     
          WRITE(7,6002)(SRSIG(K),SISIG(K),COMSIG(K),K=1,N)                      
6000  CONTINUE                                                                  
C                                                                               
C                                                                               
C   (7) CALL SUBROUTINE WITH SQUARE WAVE-WITH DIFFERENT IOPT                    
C   ********************************************************                    
C                                                                               
      WRITE(7,7003)                                                             
      N=64                                                                      
      DO 7000 I9=1,3,2                                                          
          IOPT=I9+4                                                             
          CALL CSQRGEN(COMSIG,SSR,SSI)                                          
C                                                                               
          CALL CDFTC(N,COMSIG,IOPT)                                             
          CALL UERREP('FFTTEST',5,.FALSE.)                                      
          CALL UERCLR                                                           
C                                                                               
          WRITE(7,7001)IOPT                                                     
          WRITE(7,7002)(SSR(K),SSI(K),COMSIG(K),K=1,N)                          
7000  CONTINUE                                                                  
C                                                                               
C   (8) CALL FOURIER TRANSFORM PAIRS                                            
C   *********************************                                           
C                                                                               
C                                                                               
      CALL CSQRGEN(COMSIG,SSR,SSI)                                              
C                                                                               
      CALL CDFTC(N,COMSIG,5)                                                    
      CALL UERREP('FFTTEST',6,.FALSE.)                                          
      CALL UERCLR                                                               
C                                                                               
      CALL CDFTC(N,COMSIG,6)                                                    
      CALL UERREP('FFTTEST',6,.FALSE.)                                          
      CALL UERCLR                                                               
C                                                                               
      WRITE(7,8000)                                                             
      WRITE(7,8001)(SSR(K),SSI(K),COMSIG(K),K=1,N)                              
      CALL CSQRGEN(COMSIG,SSR,SSI)                                              
C                                                                               
      CALL CDFTC(N,COMSIG,7)                                                    
      CALL UERREP('FFTTEST',6,.FALSE.)                                          
      CALL UERCLR                                                               
C                                                                               
      CALL CDFTC(N,COMSIG,4)                                                    
      CALL UERREP('FFTTEST',6,.FALSE.)                                          
      CALL UERCLR                                                               
C                                                                               
      WRITE(7,8002)                                                             
      WRITE(7,8003)(SSR(K),SSI(K),COMSIG(K),K=1,N)                              
C                                                                               
C     FORMAT STATEMENTS                                                         
C     *****************                                                         
C                                                                               
8003   FORMAT(4(2X,E14.7,2X))                                                   
7002      FORMAT(4(2X,E14.7,2X))                                                
8002   FORMAT(/,X,'(b) CALL FORWARD FT (IOPT=3) THEN INVERSE'                   
     +' FT (IOPT=0)',/)                                                         
8001   FORMAT(4(2X,E14.7,2X))                                                   
8000   FORMAT(//,X,'TEST(7):TESTING OF FT PAIRS',/,X,30('*'),//,X,'(a)'         
     +' CALL FORWARD FT(IOPT=4) THEN INVERSE FT(IOPT=6)')                       
7001      FORMAT(//,X,'IOPT=',I2,//,7X,'REAL I/P',10X,'IMAG I/P',10X,           
     +'REAL O/P',10X,'IMAG O/P',/,7X,8('*'),10X,8('*'),10X,                     
     +,8('*'),10X,8('*'),/)                                                     
7003  FORMAT(//,X,'TEST(5):CALL SUBROUTINE WITH IOPT=5,7',                      
     +'(SQUARE WAVE)',/,X,50('*'),//)                                           
6002      FORMAT(4(2X,E14.7,2X))                                                
6001      FORMAT(/,X,'IOPT=',I2,//,7X,'REAL I/P',10X,'IMAG I/P',                
     +10X,'REAL O/P',10X,'IMAG O/P',/,7X,8('*'),10X,8('*'),10X,                 
     +8('*'),10X,8('*'),/)                                                      
6003  FORMAT(X,'TEST(4):CALL SUBROUTINE WITH IOPT=5,7'                          
     +,'(SINE WAVE)',/,X,49('*'),/)                                             
4001  FORMAT(//)                                                                
4000  FORMAT(X,'TEST(3):CALL CDFTC WITH IOPT=9',/,X,30('*'),                    
     +/)                                                                        
3001  FORMAT(//)                                                                
3000  FORMAT(X,'TEST(2):CALL CDFTC WITH 4096 SAMPLES',                          
     +/,X,36('*'),/)                                                            
2001  FORMAT(//)                                                                
2000  FORMAT(X,'TEST(1):CALL CDFTC WITH ONE SAMPLE',/,                          
     +X,34('*'),/)                                                              
C   (9) END                                                                     
C   ********                                                                    
C                                                                               
      STOP                                                                      
      END                                                                       
