MF_FFT MD_FFT ME_FFT
MF_FFTtoC MD_FFTtoC ME_FFTtoC
MCF_FFT MCD_FFT MCE_FFT
Functiontwo-dimensional Fast Fourier Transform
Syntax C/C++#include <MFstd.h>
void MF_FFT( fMatrix Y, fMatrix X, ui ht, ui len, int dir );
void MCF_FFT( cfMatrix Y, cfMatrix X, ui ht, ui len, int dir );
void MF_FFTtoC( cfMatrix Y, fMatrix X, ui ht, ui len );
C++ MatObj#include <OptiVec.h>
void matrix<T>::FFT( const matrix<T>& MX, int dir );
void matrix<complex<T> >::FFT( const matrix<complex<T> >& MX, int dir );
void matrix<complex<T> >::FFTtoC( const matrix<T>& MX );
Pascal/Delphiuses MFstd;
procedure MF_FFT( MY, MX:fMatrix; ht, len:UIntSize; dir:Integer );
procedure MCF_FFT( MY, MX:cfMatrix; ht, len:UIntSize; dir:Integer );
procedure MF_FFTtoC( MY:cfMatrix; MX:fMatrix; ht, len:UIntSize );
DescriptionThe Fourier transform of MX is calculated and stored in MY. The forward transform is obtained by setting dir = 1, the inverse (or backward) transform by setting dir = -1. A Fast Fourier Transform algorithm is used that requires both ht and len to be powers of 2.
Complex version: Both MX and the output MY are complex matrices.
Real-to-complex version: The input matrix MX is real. The output matrix MY is complex. As this function can only perform a forward transform, no argument "dir" is needed.
Purely real version: For the forward transform, MX is a real matrix. The output MY is also defined as fMatrix, although it consists of complex numbers. The reason is that, just as in the one-dimensional case, the symmetry properties of two-dimensional FFT allow to store the result in a packed format, fitting into the same memory space as the input matrix. The order of storage in MY is derived from the ordering in the one-dimensional case, with the packing applied first to all rows, then to the columns. The resulting order is indicated in the following table. U means the uncompressed result.
U0,0.ReU0,len/2.ReU0,1.ReU0,1.Im···U0,len/2-1.ReU0,len/2-1.Im
Uht/2,0.ReUht/2,len/2.ReU1,1.ReU1,1.Im···U1,len/2-1.ReU1,len/2-1.Im
U1,0.ReU1,len/2.ReU2,1.ReU2,1.Im···U2,len/2-1.ReU2,len/2-1.Im
U1,0.ImU1,len/2.ImU3,1.ReU3,1.Im···U3,len/2-1.ReU3,len/2-1.Im
·····················
Uht/2-1,0.ReUht/2-1,len/2.Re···············
Uht/2-1,0.ImUht/2-1,len/2.ImUht-1,1.ReUht-1,1.Im···Uht-1,len/2-1.ReUht-1,len/2-1.Im
 
For inverse real-matrix FFT, the input matrix has to be of this packed-complex format, and you get a real matrix. If you prefer to get the result of forward FFT as a true complex matrix, use MF_FFTtoC.

About special versions with the prefixes MFs_, MFl_, and MFp_, consult chapter 4.8.

Error handlingIf either ht or len is not a power of 2, VF_FFT (on which MF_FFT is based) complains "Size must be an integer power of 2" and the program is aborted.
See alsoMF_Cols_FFT,   MF_Rows_FFT,   chapter 12,   chapter 4.8 of http://www.optivec.com/vecfuncs/

MatrixLib Table of Contents  OptiVec home