Chris@19: Chris@19: Chris@19: Real-data DFT Array Format - FFTW 3.3.4 Chris@19: Chris@19: Chris@19: Chris@19: Chris@19: Chris@19: Chris@19: Chris@19: Chris@19: Chris@19: Chris@19: Chris@19: Chris@19: Chris@19:
Chris@19: Chris@19: Chris@19:

Chris@19: Next: , Chris@19: Previous: Real-data DFTs, Chris@19: Up: Basic Interface Chris@19:


Chris@19:
Chris@19: Chris@19:

4.3.4 Real-data DFT Array Format

Chris@19: Chris@19:

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

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

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

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