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