Chris@10: Chris@10: Chris@10: 1d Real-even DFTs (DCTs) - FFTW 3.3.3 Chris@10: Chris@10: Chris@10: Chris@10: Chris@10: Chris@10: Chris@10: Chris@10: Chris@10: Chris@10: Chris@10: Chris@10: Chris@10: Chris@10:
Chris@10: Chris@10: Chris@10:

Chris@10: Next: , Chris@10: Previous: The 1d Real-data DFT, Chris@10: Up: What FFTW Really Computes Chris@10:


Chris@10:
Chris@10: Chris@10:

4.8.3 1d Real-even DFTs (DCTs)

Chris@10: Chris@10:

The Real-even symmetry DFTs in FFTW are exactly equivalent to the unnormalized Chris@10: forward (and backward) DFTs as defined above, where the input array Chris@10: X of length N is purely real and is also even symmetry. In Chris@10: this case, the output array is likewise real and even symmetry. Chris@10: Chris@10: Chris@10:

For the case of REDFT00, this even symmetry means that Chris@10: Xj = XN-j,where we take X to be periodic so that Chris@10: XN = X0. Because of this redundancy, only the first n real numbers are Chris@10: actually stored, where N = 2(n-1). Chris@10: Chris@10:

The proper definition of even symmetry for REDFT10, Chris@10: REDFT01, and REDFT11 transforms is somewhat more intricate Chris@10: because of the shifts by 1/2 of the input and/or output, although Chris@10: the corresponding boundary conditions are given in Real even/odd DFTs (cosine/sine transforms). Because of the even symmetry, however, Chris@10: the sine terms in the DFT all cancel and the remaining cosine terms are Chris@10: written explicitly below. This formulation often leads people to call Chris@10: such a transform a discrete cosine transform (DCT), although it is Chris@10: really just a special case of the DFT. Chris@10: Chris@10: Chris@10:

In each of the definitions below, we transform a real array X of Chris@10: length n to a real array Y of length n: Chris@10: Chris@10:

REDFT00 (DCT-I)
Chris@10: Chris@10:

An REDFT00 transform (type-I DCT) in FFTW is defined by: Chris@10:

.
Note that this transform is not defined for n=1. For n=2, Chris@10: the summation term above is dropped as you might expect. Chris@10: Chris@10:
REDFT10 (DCT-II)
Chris@10: Chris@10:

An REDFT10 transform (type-II DCT, sometimes called “the” DCT) in FFTW is defined by: Chris@10:

.
Chris@10: Chris@10:
REDFT01 (DCT-III)
Chris@10: Chris@10:

An REDFT01 transform (type-III DCT) in FFTW is defined by: Chris@10:

.
In the case of n=1, this reduces to Chris@10: Y0 = X0. Up to a scale factor (see below), this is the inverse of REDFT10 (“the” DCT), and so the REDFT01 (DCT-III) is sometimes called the “IDCT”. Chris@10: Chris@10: Chris@10:
REDFT11 (DCT-IV)
Chris@10: Chris@10:

An REDFT11 transform (type-IV DCT) in FFTW is defined by: Chris@10:

.
Chris@10: Chris@10:
Inverses and Normalization
Chris@10: Chris@10:

These definitions correspond directly to the unnormalized DFTs used Chris@10: elsewhere in FFTW (hence the factors of 2 in front of the Chris@10: summations). The unnormalized inverse of REDFT00 is Chris@10: REDFT00, of REDFT10 is REDFT01 and vice versa, and Chris@10: of REDFT11 is REDFT11. Each unnormalized inverse results Chris@10: in the original array multiplied by N, where N is the Chris@10: logical DFT size. For REDFT00, N=2(n-1) (note that Chris@10: n=1 is not defined); otherwise, N=2n. Chris@10: Chris@10: Chris@10:

In defining the discrete cosine transform, some authors also include Chris@10: additional factors of Chris@10: √2(or its inverse) multiplying selected inputs and/or outputs. This is a Chris@10: mostly cosmetic change that makes the transform orthogonal, but Chris@10: sacrifices the direct equivalence to a symmetric DFT. Chris@10: Chris@10: Chris@10: Chris@10: