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