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