fft2

Functions

int main(int argc, char *argv[])

fft2 [ option ] [ infile ]

  • -l int

    • FFT length \((1 \le L)\)

  • -r int

    • number of rows \((1 \le M \le L)\)

  • -c int

    • number of columns \((1 \le N \le L)\)

  • -o int

    • output format

      • 0 real and imaginary parts

      • 1 real part

      • 2 imaginary part

      • 3 amplitude spectrum

      • 4 power spectrum

  • -p int

    • output style

      • 0 standard

      • 1 transposed

      • 2 transposed with boundary

      • 3 quadrand with boundary

  • infile str

    • double-type 2D data sequence

  • stdout

    • double-type 2D FFT sequence

The input and output are arranged as follows.

../_images/fft2_1.png

The output are reshaped by -p option.

../_images/fft2_2.png

Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

See also

fft ifft2 fftr2

class TwoDimensionalFastFourierTransform

Calculate 2D DFT of complex-valued input data.

The inputs are two \(M \times N\) matrices that represent real and imaginary parts:

\[ \begin{array}{cc} \mathrm{Re}(\boldsymbol{x}), & \mathrm{Im}(\boldsymbol{x}). \end{array} \]
The outputs are two \(L \times L \) matrices:
\[ \begin{array}{cccc} \mathrm{Re}(\boldsymbol{X}), & \mathrm{Im}(\boldsymbol{X}), \end{array} \]
where \(L\) is the FFT length and must be a power of two.

Public Functions

TwoDimensionalFastFourierTransform(int num_row, int num_column, int fft_length)
Parameters:
  • num_row[in] Number of rows, \(M\).

  • num_column[in] Number of columns, \(N\).

  • fft_length[in] FFT length, \(L\).

inline int GetNumRow() const
Returns:

Number of rows of input.

inline int GetNumColumn() const
Returns:

Number of columns of input.

inline int GetFftLength() const
Returns:

FFT length.

inline bool IsValid() const
Returns:

True if this object is valid.

bool Run(const Matrix &real_part_input, const Matrix &imag_part_input, Matrix *real_part_output, Matrix *imag_part_output, TwoDimensionalFastFourierTransform::Buffer *buffer) const
Parameters:
  • real_part_input[in] Real part of input.

  • imag_part_input[in] Imaginary part of input.

  • real_part_output[out] Real part of output.

  • imag_part_output[out] Imaginary part of output.

  • buffer[out] Buffer.

Returns:

True on success, false on failure.

bool Run(Matrix *real_part, Matrix *imag_part, TwoDimensionalFastFourierTransform::Buffer *buffer) const
Parameters:
  • real_part[inout] Real part.

  • imag_part[inout] Imaginary part.

  • buffer[out] Buffer.

Returns:

True on success, false on failure.

class Buffer

Buffer for TwoDimensionalFastFourierTransform class.