Main Content

Optimize Generated Code for Fast Fourier Transform Functions

Code generated for Fast Fourier Transform (FFT) functions is deployable to multiple target CPUs. To generate deployable code for your FFT functions, certain modifications are required. Generate optimized code by using the FFT implementation and library required by your target hardware. The code generator enables you to generate code for MATLAB® FFT functions (fft, fft2, fftn, ifft, ifft2, ifftn) or optimize the generated code by using custom FFTW libraries with MATLAB FFT functions. You can also generate code for DSP System Toolbox™ implementations, (dsp.FFT (DSP System Toolbox) and dsp.IFFT (DSP System Toolbox) ).

To generate fixed-point code for your FFT workflow, use the DSP System Toolbox implementations. These implementations have fixed-point properties that are set according to your required FFT workflow. See dsp.FFT (DSP System Toolbox).

Intel Target Support

You can deploy code generated for MATLAB FFT implementations and DSP System Toolbox implementations to Intel® target CPUs. The supported implementations provide input support as listed in this table.

FFT ImplementationInput SupportReference
MATLAB FFT functions in standalone code
  • Power of two, nonpower of Two

  • Variable-size double and single inputs

By default, the code generator produces standalone code for the FFT algorithms instead of producing FFT library calls.
MATLAB FFT functions with custom FFTW libraries in standalone code

  • Power of two, nonpower of two

  • Variable-size double and single inputs

All optimizations are dependent on target CPU data type support.

To use FFTW libraries for your target CPUs:

  • Obtain FFTW libraries that are compiled for your target CPU.

  • Obtain these libraries from a third-party or compiled on your own.

See Speed Up Fast Fourier Transforms in Generated Standalone Code by Using FFTW Library Calls.

dsp.FFT (DSP System Toolbox) functions in standalone C code
  • Power of two

  • Fixed-size double and single inputs

Does not support variable-size inputs without FFTW libraries. See dsp.FFT (DSP System Toolbox).
dsp.FFT (DSP System Toolbox) functions with FFTW libraries in standalone C code
  • Power of two, nonpower of two

  • Variable-size double and single inputs

Set the 'FFTImplementation' property to 'FFTW'.

  • This setting uses a platform-specific precompiled library. For example, you can use only code generated on a Linux® machine on another Linux machine.

  • Generated code runs independently of a MATLAB installation.

ARM Target Support

You can deploy code generated for MATLAB FFT implementations and DSP System Toolbox implementations to ARM® target CPUs. The supported implementations provide input support as listed in this table.

FFT ImplementationInput SupportReference
MATLAB FFT functions in standalone code
  • Power of two, nonpower of two

  • Variable-size double and single inputs

By default, the code generator produces standalone code for the FFT algorithms instead of producing FFT library calls. See:
MATLAB FFT functions with custom FFTW libraries in standalone code
  • Power of two, nonpower of two

  • Variable-size double and single inputs

All optimizations are dependent on target CPU data type support.
To use FFTW libraries for your target CPUs:
  • Obtain FFTW libraries that are compiled for your target CPU.

  • Obtain these libraries from a third-party or compiled on your own.

dsp.FFT (DSP System Toolbox) functions in standalone C code
  • Power of two

  • Fixed-size double and single inputs

Does not support variable-size inputs without FFTW libraries.
dsp.FFT (DSP System Toolbox) functions with CRL/support packages in standalone C code
  • Power of two

  • Variable-size single inputs

MEX Target Support

When generating MEX code for your Fast Fourier Transform functions, the supported implementations provide support as listed in this table.

FFT ImplementationInput SupportReference
MATLAB FFT functions in MEX code
  • Power of two, nonpower of two

  • Variable-size double and single inputs

When you generated MEX code for FFT functions, the code generator uses MATLAB FFT algorithms.

dsp.FFT (DSP System Toolbox) functions in MEX code
  • Power of two

  • Fixed-size double and single inputs

Does not support variable-size inputs without FFTW libraries.
dsp.FFT (DSP System Toolbox) functions with FFTW libraries in MEX code
  • Power of Two, nonpower of two

  • Variable-size double and single inputs

Set the 'FFTImplementation' property to 'FFTW'.
  • This setting uses a platform-specific precompiled library. For example, you can use only code generated on a Linux machine on another Linux machine.

  • Generated code runs independently of a MATLAB installation.

See Also

| | | | | | (DSP System Toolbox) | (DSP System Toolbox)

Related Topics

External Websites