d@0: d@0:
d@0:d@0: d@0: d@0: Next: Real-to-Real Transforms, d@0: Previous: Real-data DFTs, d@0: Up: Basic Interface d@0:
d@0: The output of a DFT of real data (r2c) contains symmetries that, in
d@0: principle, make half of the outputs redundant (see What FFTW Really Computes). (Similarly for the input of an inverse c2r transform.) In
d@0: practice, it is not possible to entirely realize these savings in an
d@0: efficient and understandable format that generalizes to
d@0: multi-dimensional transforms. Instead, the output of the r2c
d@0: transforms is slightly over half of the output of the
d@0: corresponding complex transform. We do not “pack” the data in any
d@0: way, but store it as an ordinary array of fftw_complex
values.
d@0: In fact, this data is simply a subsection of what would be the array in
d@0: the corresponding complex transform.
d@0:
d@0:
Specifically, for a real transform of d (= rank
)
d@0: dimensions n0 × n1 × n2 × … × nd-1, the complex data is an n0 × n1 × n2 × … × (nd-1/2 + 1) array of
d@0: fftw_complex
values in row-major order (with the division rounded
d@0: down). That is, we only store the lower half (non-negative
d@0: frequencies), plus one element, of the last dimension of the data from
d@0: the ordinary complex transform. (We could have instead taken half of
d@0: any other dimension, but implementation turns out to be simpler if the
d@0: last, contiguous, dimension is used.)
d@0:
d@0:
For an out-of-place transform, the real data is simply an array with d@0: physical dimensions n0 × n1 × n2 × … × nd-1 in row-major order. d@0: d@0:
For an in-place transform, some complications arise since the complex data
d@0: is slightly larger than the real data. In this case, the final
d@0: dimension of the real data must be padded with extra values to
d@0: accommodate the size of the complex data—two extra if the last
d@0: dimension is even and one if it is odd. That is, the last dimension of
d@0: the real data must physically contain
d@0: 2 * (nd-1/2+1)double
values (exactly enough to hold the complex data). This
d@0: physical array size does not, however, change the logical array
d@0: size—only
d@0: nd-1values are actually stored in the last dimension, and
d@0: nd-1is the last dimension passed to the planner.
d@0:
d@0:
d@0:
d@0: