cannam@95: cannam@95: cannam@95: The Halfcomplex-format DFT - FFTW 3.3.3 cannam@95: cannam@95: cannam@95: cannam@95: cannam@95: cannam@95: cannam@95: cannam@95: cannam@95: cannam@95: cannam@95: cannam@95: cannam@95: cannam@95:
cannam@95: cannam@95: cannam@95:

cannam@95: Next: , cannam@95: Previous: More DFTs of Real Data, cannam@95: Up: More DFTs of Real Data cannam@95:


cannam@95:
cannam@95: cannam@95:

2.5.1 The Halfcomplex-format DFT

cannam@95: cannam@95:

An r2r kind of FFTW_R2HC (r2hc) corresponds to an r2c DFT cannam@95: (see One-Dimensional DFTs of Real Data) but with “halfcomplex” cannam@95: format output, and may sometimes be faster and/or more convenient than cannam@95: the latter. cannam@95: The inverse hc2r transform is of kind FFTW_HC2R. cannam@95: This consists of the non-redundant half of the complex output for a 1d cannam@95: real-input DFT of size n, stored as a sequence of n real cannam@95: numbers (double) in the format: cannam@95: cannam@95:

cannam@95: r0, r1, r2, ..., rn/2, i(n+1)/2-1, ..., i2, i1 cannam@95:

cannam@95: cannam@95:

Here, cannam@95: rkis the real part of the kth output, and cannam@95: ikis the imaginary part. (Division by 2 is rounded down.) For a cannam@95: halfcomplex array hc[n], the kth component thus has its cannam@95: real part in hc[k] and its imaginary part in hc[n-k], with cannam@95: the exception of k == 0 or n/2 (the latter cannam@95: only if n is even)—in these two cases, the imaginary part is cannam@95: zero due to symmetries of the real-input DFT, and is not stored. cannam@95: Thus, the r2hc transform of n real values is a halfcomplex array of cannam@95: length n, and vice versa for hc2r. cannam@95: cannam@95: cannam@95:

Aside from the differing format, the output of cannam@95: FFTW_R2HC/FFTW_HC2R is otherwise exactly the same as for cannam@95: the corresponding 1d r2c/c2r transform cannam@95: (i.e. FFTW_FORWARD/FFTW_BACKWARD transforms, respectively). cannam@95: Recall that these transforms are unnormalized, so r2hc followed by hc2r cannam@95: will result in the original data multiplied by n. Furthermore, cannam@95: like the c2r transform, an out-of-place hc2r transform will cannam@95: destroy its input array. cannam@95: cannam@95:

Although these halfcomplex transforms can be used with the cannam@95: multi-dimensional r2r interface, the interpretation of such a separable cannam@95: product of transforms along each dimension is problematic. For example, cannam@95: consider a two-dimensional n0 by n1, r2hc by r2hc cannam@95: transform planned by fftw_plan_r2r_2d(n0, n1, in, out, FFTW_R2HC, cannam@95: FFTW_R2HC, FFTW_MEASURE). Conceptually, FFTW first transforms the rows cannam@95: (of size n1) to produce halfcomplex rows, and then transforms the cannam@95: columns (of size n0). Half of these column transforms, however, cannam@95: are of imaginary parts, and should therefore be multiplied by i cannam@95: and combined with the r2hc transforms of the real columns to produce the cannam@95: 2d DFT amplitudes; FFTW's r2r transform does not perform this cannam@95: combination for you. Thus, if a multi-dimensional real-input/output DFT cannam@95: is required, we recommend using the ordinary r2c/c2r cannam@95: interface (see Multi-Dimensional DFTs of Real Data). cannam@95: cannam@95: cannam@95: cannam@95: