Developer Reference

  • 2021.1
  • 12/04/2020
  • Public Content
Contents

Configuring and Computing an FFT in C/C++

The table below summarizes information on configuring and computing an FFT in C/C++ for all kinds of transforms and possible combinations of input and output domains.
FFT to Compute
Input Data
Output Data
Required FFT Function Calls
Complex-to-complex,
in-place,
forward or backward
Interleaved complex numbers
Interleaved complex numbers
/* Configure a Descriptor */ status = DftiCreateDescriptor(&hand, <precision>, DFTI_COMPLEX, <dimension>, <sizes>); status = DftiCommitDescriptor(hand); /* Compute an FFT */ /* forward FFT */ status = DftiComputeForward(hand, X_inout); /* or backward FFT */ status = DftiComputeBackward(hand, X_inout);
Complex-to-complex,
out-of-place,
forward or backward
Interleaved complex numbers
Interleaved complex numbers
/* Configure a Descriptor */ status = DftiCreateDescriptor(&hand, <precision>, DFTI_COMPLEX, <dimension>, <sizes>); status = DftiSetValue(hand, DFTI_PLACEMENT, DFTI_NOT_INPLACE); status = DftiCommitDescriptor(hand); /* Compute an FFT */ /* forward FFT */ status = DftiComputeForward(hand, X_in, Y_out); /* or backward FFT */ status = DftiComputeBackward(hand, X_in, Y_out);
Complex-to-complex,
in-place,
forward or backward
Split-complex numbers
Split-complex numbers
/* Configure a Descriptor */ status = DftiCreateDescriptor(&hand, <precision>, DFTI_COMPLEX, <dimension>, <sizes>); status = DftiSetValue(hand, DFTI_COMPLEX_STORAGE, DFTI_REAL_REAL); status = DftiCommitDescriptor(hand); /* Compute an FFT */ /* forward FFT */ status = DftiComputeForward(hand, Xre_inout, Xim_inout); /* or backward FFT */ status = DftiComputeBackward(hand, Xre_inout, Xim_inout);
Complex-to-complex,
out-of-place,
forward or backward
Split-complex numbers
Split-complex numbers
/* Configure a Descriptor */ status = DftiCreateDescriptor(&hand, <precision>, DFTI_COMPLEX, <dimension>, <sizes>); status = DftiSetValue(hand, DFTI_COMPLEX_STORAGE, DFTI_REAL_REAL); status = DftiSetValue(hand, DFTI_PLACEMENT, DFTI_NOT_INPLACE); status = DftiCommitDescriptor(hand); /* Compute an FFT */ /* forward FFT */ status = DftiComputeForward(hand, Xre_in, Xim_in, Yre_out, Yim_out); /* or backward FFT */ status = DftiComputeBackward(hand, Xre_in, Xim_in, Yre_out, Yim_out);
Real-to-complex,
in-place,
forward
Real numbers
Numbers in the CCE format
/* Configure a Descriptor */ status = DftiCreateDescriptor(&hand, <precision>, DFTI_REAL, <dimension>, <sizes>); status = DftiSetValue(hand, DFTI_CONJUGATE_EVEN_STORAGE, DFTI_COMPLEX_COMPLEX); status = DftiSetValue(hand, DFTI_PACKED_FORMAT, DFTI_CCE_FORMAT); status = DftiSetValue(hand, DFTI_INPUT_STRIDES, <real_strides>); status = DftiSetValue(hand, DFTI_OUTPUT_STRIDES, <complex_strides>); status = DftiCommitDescriptor(hand); /* Compute an FFT */ status = DftiComputeForward(hand, X_inout);
Real-to-complex,
out-of-place,
forward
Real numbers
Numbers in the CCE format
/* Configure a Descriptor */ status = DftiCreateDescriptor(&hand, <precision>, DFTI_REAL, <dimension>, <sizes>); status = DftiSetValue(hand, DFTI_CONJUGATE_EVEN_STORAGE, DFTI_COMPLEX_COMPLEX); status = DftiSetValue(hand, DFTI_PACKED_FORMAT, DFTI_CCE_FORMAT); status = DftiSetValue(hand, DFTI_PLACEMENT, DFTI_NOT_INPLACE); status = DftiSetValue(hand, DFTI_INPUT_STRIDES, <real_strides>); status = DftiSetValue(hand, DFTI_OUTPUT_STRIDES, <complex_strides>); status = DftiCommitDescriptor(hand); /* Compute an FFT */ status = DftiComputeForward(hand, X_in, Y_out);
Complex-to-real,
in-place,
backward
Numbers in the CCE format
Real numbers
/* Configure a Descriptor */ status = DftiCreateDescriptor(&hand, <precision>, DFTI_REAL, <dimension>, <sizes>); status = DftiSetValue(hand, DFTI_CONJUGATE_EVEN_STORAGE, DFTI_COMPLEX_COMPLEX); status = DftiSetValue(hand, DFTI_PACKED_FORMAT, DFTI_CCE_FORMAT); status = DftiSetValue(hand, DFTI_INPUT_STRIDES, <complex_strides>); status = DftiSetValue(hand, DFTI_OUTPUT_STRIDES, <real_strides>); status = DftiCommitDescriptor(hand); /* Compute an FFT */ status = DftiComputeBackward(hand, X_inout);
Complex-to-real,
out-of-place,
backward
Numbers in the CCE format
Real numbers
/* Configure a Descriptor */ status = DftiCreateDescriptor(&hand, <precision>, DFTI_REAL, <dimension>, <sizes>); status = DftiSetValue(hand, DFTI_CONJUGATE_EVEN_STORAGE, DFTI_COMPLEX_COMPLEX); status = DftiSetValue(hand, DFTI_PLACEMENT, DFTI_NOT_INPLACE); status = DftiSetValue(hand, DFTI_PACKED_FORMAT, DFTI_CCE_FORMAT); status = DftiSetValue(hand, DFTI_INPUT_STRIDES, <complex_strides>); status = DftiSetValue(hand, DFTI_OUTPUT_STRIDES, <real_strides>); status = DftiCommitDescriptor(hand); /* Compute an FFT */ status = DftiComputeBackward(hand, X_in, Y_out);
You can find C programs that illustrate configuring and computing FFTs in the
examples/dftc/
subdirectory of your
Intel® oneAPI Math Kernel Library
directory.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.