cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: FFTW 3.3.5: Real-data DFT Array Format cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127:
cannam@127:

cannam@127: Next: , Previous: , Up: Basic Interface   [Contents][Index]

cannam@127:
cannam@127:
cannam@127: cannam@127:

4.3.4 Real-data DFT Array Format

cannam@127: cannam@127: cannam@127:

The output of a DFT of real data (r2c) contains symmetries that, in cannam@127: principle, make half of the outputs redundant (see What FFTW Really Computes). (Similarly for the input of an inverse c2r transform.) In cannam@127: practice, it is not possible to entirely realize these savings in an cannam@127: efficient and understandable format that generalizes to cannam@127: multi-dimensional transforms. Instead, the output of the r2c cannam@127: transforms is slightly over half of the output of the cannam@127: corresponding complex transform. We do not “pack” the data in any cannam@127: way, but store it as an ordinary array of fftw_complex values. cannam@127: In fact, this data is simply a subsection of what would be the array in cannam@127: the corresponding complex transform. cannam@127:

cannam@127:

Specifically, for a real transform of d (= rank) cannam@127: dimensions n0 × n1 × n2 × … × nd-1, the complex data is an n0 × n1 × n2 × … × (nd-1/2 + 1) array of cannam@127: fftw_complex values in row-major order (with the division rounded cannam@127: down). That is, we only store the lower half (non-negative cannam@127: frequencies), plus one element, of the last dimension of the data from cannam@127: the ordinary complex transform. (We could have instead taken half of cannam@127: any other dimension, but implementation turns out to be simpler if the cannam@127: last, contiguous, dimension is used.) cannam@127:

cannam@127: cannam@127:

For an out-of-place transform, the real data is simply an array with cannam@127: physical dimensions n0 × n1 × n2 × … × nd-1 in row-major order. cannam@127:

cannam@127: cannam@127: cannam@127:

For an in-place transform, some complications arise since the complex data cannam@127: is slightly larger than the real data. In this case, the final cannam@127: dimension of the real data must be padded with extra values to cannam@127: accommodate the size of the complex data—two extra if the last cannam@127: dimension is even and one if it is odd. That is, the last dimension of cannam@127: the real data must physically contain cannam@127: 2 * (nd-1/2+1)double values (exactly enough to hold the complex data). This cannam@127: physical array size does not, however, change the logical array cannam@127: size—only cannam@127: nd-1values are actually stored in the last dimension, and cannam@127: nd-1is the last dimension passed to the planner. cannam@127:

cannam@127:
cannam@127:
cannam@127:

cannam@127: Next: , Previous: , Up: Basic Interface   [Contents][Index]

cannam@127:
cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: