Algorithm 339: an algol procedure for the fast Fourier transform with arbitrary factors

The following procedures are based on the Cooley-Tukey algor i thm [1] for comput ing the finite Fourier t r ans fo rm of a complex da ta vector; the dimension of the da t a vector is assumed here to be a power of two. Procedure COMPLEXTRANSFORM computes ei ther the complex Fourier t ransform or its inverse. Procedure REALTRANSFORM computes ei ther the Fourier coefficients of a sequence of real da ta points or eva lua tes a Fourier series wi th given cosine and sine coefficients. The number of ar i thmet ic operat ions for ei ther procedure is proport ional to n logs n, where n is the number of da ta points. Procedures FFT2, REVFFT2, REORDER, and REAL TRAN are building blocks, and are used in the two complete procedures ment ioned above. The fas t t r ans fo rm can be computed in a number of different ways, and these bui lding block procedures were wri t ten so as to make practical the comput ing of large t rans forms on a system wi th vir tual memory. Using a method proposed by Singleton [2], d a t a is accessed in sub-sequences of consecutive a r ray elements , and as m u ch comput ing as possible is done in one section of the d a t a before moving on to another. Procedure FFT2 computes the Fourier t r ans fo rm of da ta in normal order, giving a resu l t in reverse b ina ry order. Procedure REVFFT2 computes the Fourier t r ans fo rm of da ta in reverse b ina ry order and leaves the resul t in normal b inary order. Procedure REORDER permutes a complex vector f rom b inary to reverse b ina ry order or f rom reverse b inary to b inary order; this procedure also permutes real da ta in prepara t ion for efficient use of the complex Fourier t ransform. Procedures FFT2, REVFFT2, and REORDER m a y also be used to compute mul t iva r i a te Fourier t ransforms. The procedure R E A L T R A N is used to unscramble and combine the complex t rans forms of the even and odd numbered e lements of a sequence of real d a t a points . This procedure is not restr ic ted to powers of two and can be used whenever the number of da t a points is even.