d@0: d@0:
d@0:d@0: d@0: d@0: Next: Real even/odd DFTs (cosine/sine transforms), d@0: Previous: More DFTs of Real Data, d@0: Up: More DFTs of Real Data d@0:
An r2r kind of FFTW_R2HC
(r2hc) corresponds to an r2c DFT
d@0: (see One-Dimensional DFTs of Real Data) but with “halfcomplex”
d@0: format output, and may sometimes be faster and/or more convenient than
d@0: the latter.
d@0: The inverse hc2r transform is of kind FFTW_HC2R
.
d@0: This consists of the non-redundant half of the complex output for a 1d
d@0: real-input DFT of size n
, stored as a sequence of n
real
d@0: numbers (double
) in the format:
d@0:
d@0:
d@0: r0, r1, r2, ..., rn/2, i(n+1)/2-1, ..., i2, i1 d@0:
d@0: d@0:Here,
d@0: rkis the real part of the kth output, and
d@0: ikis the imaginary part. (Division by 2 is rounded down.) For a
d@0: halfcomplex array hc[n]
, the kth component thus has its
d@0: real part in hc[k]
and its imaginary part in hc[n-k]
, with
d@0: the exception of k
==
0
or n/2
(the latter
d@0: only if n
is even)—in these two cases, the imaginary part is
d@0: zero due to symmetries of the real-input DFT, and is not stored.
d@0: Thus, the r2hc transform of n
real values is a halfcomplex array of
d@0: length n
, and vice versa for hc2r.
d@0:
d@0: Aside from the differing format, the output of
d@0: FFTW_R2HC
/FFTW_HC2R
is otherwise exactly the same as for
d@0: the corresponding 1d r2c/c2r transform
d@0: (i.e. FFTW_FORWARD
/FFTW_BACKWARD
transforms, respectively).
d@0: Recall that these transforms are unnormalized, so r2hc followed by hc2r
d@0: will result in the original data multiplied by n
. Furthermore,
d@0: like the c2r transform, an out-of-place hc2r transform will
d@0: destroy its input array.
d@0:
d@0:
Although these halfcomplex transforms can be used with the
d@0: multi-dimensional r2r interface, the interpretation of such a separable
d@0: product of transforms along each dimension is problematic. For example,
d@0: consider a two-dimensional n0
by n1
, r2hc by r2hc
d@0: transform planned by fftw_plan_r2r_2d(n0, n1, in, out, FFTW_R2HC,
d@0: FFTW_R2HC, FFTW_MEASURE)
. Conceptually, FFTW first transforms the rows
d@0: (of size n1
) to produce halfcomplex rows, and then transforms the
d@0: columns (of size n0
). Half of these column transforms, however,
d@0: are of imaginary parts, and should therefore be multiplied by i
d@0: and combined with the r2hc transforms of the real columns to produce the
d@0: 2d DFT amplitudes; FFTW's r2r transform does not perform this
d@0: combination for you. Thus, if a multi-dimensional real-input/output DFT
d@0: is required, we recommend using the ordinary r2c/c2r
d@0: interface (see Multi-Dimensional DFTs of Real Data).
d@0:
d@0:
d@0:
d@0: