Chris@10: Chris@10:
Chris@10:Chris@10: Previous: Real even/odd DFTs (cosine/sine transforms), Chris@10: Up: More DFTs of Real Data Chris@10:
If you are planning to use the DHT because you've heard that it is Chris@10: “faster” than the DFT (FFT), stop here. The DHT is not Chris@10: faster than the DFT. That story is an old but enduring misconception Chris@10: that was debunked in 1987. Chris@10: Chris@10:
The discrete Hartley transform (DHT) is an invertible linear transform
Chris@10: closely related to the DFT. In the DFT, one multiplies each input by
Chris@10: cos - i * sin (a complex exponential), whereas in the DHT each
Chris@10: input is multiplied by simply cos + sin. Thus, the DHT
Chris@10: transforms n
real numbers to n
real numbers, and has the
Chris@10: convenient property of being its own inverse. In FFTW, a DHT (of any
Chris@10: positive n
) can be specified by an r2r kind of FFTW_DHT
.
Chris@10:
Chris@10: Like the DFT, in FFTW the DHT is unnormalized, so computing a DHT of
Chris@10: size n
followed by another DHT of the same size will result in
Chris@10: the original array multiplied by n
.
Chris@10:
Chris@10: The DHT was originally proposed as a more efficient alternative to the
Chris@10: DFT for real data, but it was subsequently shown that a specialized DFT
Chris@10: (such as FFTW's r2hc or r2c transforms) could be just as fast. In FFTW,
Chris@10: the DHT is actually computed by post-processing an r2hc transform, so
Chris@10: there is ordinarily no reason to prefer it from a performance
Chris@10: perspective.1
Chris@10: However, we have heard rumors that the DHT might be the most appropriate
Chris@10: transform in its own right for certain applications, and we would be
Chris@10: very interested to hear from anyone who finds it useful.
Chris@10:
Chris@10:
If FFTW_DHT
is specified for multiple dimensions of a
Chris@10: multi-dimensional transform, FFTW computes the separable product of 1d
Chris@10: DHTs along each dimension. Unfortunately, this is not quite the same
Chris@10: thing as a true multi-dimensional DHT; you can compute the latter, if
Chris@10: necessary, with at most rank-1
post-processing passes
Chris@10: [see e.g. H. Hao and R. N. Bracewell, Proc. IEEE 75, 264–266 (1987)].
Chris@10:
Chris@10:
For the precise mathematical definition of the DHT as used by FFTW, see Chris@10: What FFTW Really Computes. Chris@10: Chris@10:
[1] We provide the DHT mainly as a byproduct of some Chris@10: internal algorithms. FFTW computes a real input/output DFT of Chris@10: prime size by re-expressing it as a DHT plus post/pre-processing Chris@10: and then using Rader's prime-DFT algorithm adapted to the DHT.
Chris@10: Chris@10: