Real data#
When real data is subject to DFT, the resulting complex output data follows a special property. About half of the
output is redundant because they are complex conjugates of the other half. This is called the Hermitian redundancy. So, for space
and performance considerations, it is only necessary to store the non-redundant part of the data. Most FFT libraries use this property to
offer specific storage layouts for FFTs involving real data. rocFFT
provides three enumeration values for rocfft_array_type
to deal with real data FFTs:
REAL (
rocfft_array_type_real
)HERMITIAN_INTERLEAVED (
rocfft_array_type_hermitian_interleaved
)HERMITIAN_PLANAR (
rocfft_array_type_hermitian_planar
)
The REAL (rocfft_array_type_real
) enum specifies that the data is purely real. This can be used to feed real input or get back real output. The
HERMITIAN_INTERLEAVED
(rocfft_array_type_hermitian_interleaved
) and HERMITIAN_PLANAR (rocfft_array_type_hermitian_planar
) enums are similar to the corresponding full complex enums in the way
they store real and imaginary components, but store only about half of the complex output. Client applications can do just a
forward transform and analyze the output or they can process the output and do a backward transform to get back real data.
This is illustrated in the following figure.

Fig. 1 Forward and Backward Real FFTs#
Note
Real backward FFTs require that the input data be Hermitian-symmetric, as would naturally happen in the output of a real forward FFT. rocFFT will produce undefined results if this requirement is not met.
Let us consider a 1D real FFT of length

Fig. 2 1D Real FFT of Length N#
Here, C* denotes the complex conjugate. Since the values at indices greater than
Example for

Fig. 3 Example for N = 8#
Example for

Fig. 4 Example for N = 7#
For length 8, only
Supported array type combinations#
Not In-place transforms:
Forward: REAL to HERMITIAN_INTERLEAVED
Forward: REAL to HERMITIAN_PLANAR
Backward: HERMITIAN_INTERLEAVED to REAL
Backward: HERMITIAN_PLANAR to REAL
In-place transforms:
Forward: REAL to HERMITIAN_INTERLEAVED
Backward: HERMITIAN_INTERLEAVED to REAL
Setting strides#
The library currently requires the user to explicitly set input and output strides for real transforms for non-simple cases. See the following examples to understand what values to use for input and output strides under different scenarios. These examples show typical usages, but the user can allocate the buffers and choose data layout according to their need.
Examples#
The following figures and examples explain in detail the real FFT features of this library.
Here is a schematic that illustrates the forward 1D FFT (real to hermitian).

Fig. 5 1D FFT - Real to Hermitian#
Below is a schematic that shows an example of not in-place transform with even

Fig. 6 1D FFT - Real to Hermitian, Example 1#
Below is a schematic that shows an example of in-place transform with even

Fig. 7 1D FFT - Real to Hermitian, Example 2#
Below is a schematic that shows an example of in-place transform with odd

Fig. 8 1D FFT - Real to Hermitian, Example 3#
And here is a schematic that illustrates the backward 1D FFT (hermitian to real).

Fig. 9 1D FFT - Hermitian to Real#
Below is a schematic that shows an example of in-place transform with even

Fig. 10 1D FFT - Hermitian to Real, Example#
And here is a schematic that illustrates the in-place forward 2D FFT (real to hermitian).

Fig. 11 2D FFT - Real to Hermitian In Place#
Below is a schematic that shows an example of in-place 2D transform and how strides and distances are set. Notice that even though we are dealing with only 1 buffer (in-place), the output strides/distance can take different values compared to input strides/distance.

Fig. 12 2D FFT - Real to Hermitian, Example#