SUBROUTINE NL06N(N, X.SIGN) 

 C*****NLOGN COMPUTES THE DISCRETE FOURIER TRANSFORM BY THE FAST FOURIER 

 C*****TRANSFORM METHOD. REFERENCE ROBINSON, PAGE 63. 

 C*****THIS SUBROUTINE CONTAINS 51 STATEMENTS. 

 C*****N=POSITIVE INTEGER FOR THE POWER OF 2 DESIRED. 

 C*****X = INPUT AND OUTPUT DATA ARRAY (COMPLEX ). 

 C*****SIGN=-1.0 FOR FOURIER TRANSFORM, +1.0 FOR INVERSE FOURIER TRANSFORM. 



DIMENSION M(15),X(2) 



COMPLEX X,WK,HOLD,Q 



LX = 2**N 



DO 1 I = 1,N 



1 M(I) = 2**(N -I) 

 DO 4 L = 1,N 

 NBLOCK = 2**(L -1) 

 LBLOCK = LX / NBLOCK 

 LBHALF = LBLOCK / 2 

 K = 



DO 4 IBLOCK = 1, NBLOCK 



FK = K 



FLX = LX 



V = SIGN * 6.2831853071796 * FK / FLX 



WK = CMPLX(COS(V),SIN(V)) 



ISTART = LBLOCK * (IBLOCK - 1) 



00 2 I = 1, LBHALF 



J = ISTART + I 



JH = J + LBHALF 



Q = X(JH) * WK 



X(JH) = X(J) - Q 



X(J) = X(J) + Q 



2 CONTINUE 



DO 3 I = 2,N 



II = I 



IF(K.LT.M(I)) GO TO 4 



3 K = K - M(I) 



4 K = K + M(II) 

 K = 



DO 7 J = 1, LX 

 IF (K.LT.J) GO TO 5 

 HOLD = X(J) 

 X(J) = X(K + 1) 

 X(K + 1) = HOLD 



5 DO 6 I = 1,N 

 II = I 

 IF(K.LT.M(I)) GO TO 7 



6 K = K - M(I) 



7 K = K + M(II) 

 IF(SIGN.LT.O.O) RETURN 

 DO 8 I = 1,LX 



8 X(I) = X(I) / FLX 

 RETURN 



END 



174 



