cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: FFTW 3.3.5: More DFTs of Real Data cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127:
cannam@127:

cannam@127: Previous: , Up: Tutorial   [Contents][Index]

cannam@127:
cannam@127:
cannam@127: cannam@127:

2.5 More DFTs of Real Data

cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127:

FFTW supports several other transform types via a unified r2r cannam@127: (real-to-real) interface, cannam@127: cannam@127: so called because it takes a real (double) array and outputs a cannam@127: real array of the same size. These r2r transforms currently fall into cannam@127: three categories: DFTs of real input and complex-Hermitian output in cannam@127: halfcomplex format, DFTs of real input with even/odd symmetry cannam@127: (a.k.a. discrete cosine/sine transforms, DCTs/DSTs), and discrete cannam@127: Hartley transforms (DHTs), all described in more detail by the cannam@127: following sections. cannam@127:

cannam@127:

The r2r transforms follow the by now familiar interface of creating an cannam@127: fftw_plan, executing it with fftw_execute(plan), and cannam@127: destroying it with fftw_destroy_plan(plan). Furthermore, all cannam@127: r2r transforms share the same planner interface: cannam@127:

cannam@127:
cannam@127:
fftw_plan fftw_plan_r2r_1d(int n, double *in, double *out,
cannam@127:                            fftw_r2r_kind kind, unsigned flags);
cannam@127: fftw_plan fftw_plan_r2r_2d(int n0, int n1, double *in, double *out,
cannam@127:                            fftw_r2r_kind kind0, fftw_r2r_kind kind1,
cannam@127:                            unsigned flags);
cannam@127: fftw_plan fftw_plan_r2r_3d(int n0, int n1, int n2,
cannam@127:                            double *in, double *out,
cannam@127:                            fftw_r2r_kind kind0,
cannam@127:                            fftw_r2r_kind kind1,
cannam@127:                            fftw_r2r_kind kind2,
cannam@127:                            unsigned flags);
cannam@127: fftw_plan fftw_plan_r2r(int rank, const int *n, double *in, double *out,
cannam@127:                         const fftw_r2r_kind *kind, unsigned flags);
cannam@127: 
cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127:

Just as for the complex DFT, these plan 1d/2d/3d/multi-dimensional cannam@127: transforms for contiguous arrays in row-major order, transforming (real) cannam@127: input to output of the same size, where n specifies the cannam@127: physical dimensions of the arrays. All positive n are cannam@127: supported (with the exception of n=1 for the FFTW_REDFT00 cannam@127: kind, noted in the real-even subsection below); products of small cannam@127: factors are most efficient (factorizing n-1 and n+1 for cannam@127: FFTW_REDFT00 and FFTW_RODFT00 kinds, described below), but cannam@127: an O(n log n) algorithm is used even for prime sizes. cannam@127:

cannam@127:

Each dimension has a kind parameter, of type cannam@127: fftw_r2r_kind, specifying the kind of r2r transform to be used cannam@127: for that dimension. cannam@127: cannam@127: cannam@127: (In the case of fftw_plan_r2r, this is an array kind[rank] cannam@127: where kind[i] is the transform kind for the dimension cannam@127: n[i].) The kind can be one of a set of predefined constants, cannam@127: defined in the following subsections. cannam@127:

cannam@127:

In other words, FFTW computes the separable product of the specified cannam@127: r2r transforms over each dimension, which can be used e.g. for partial cannam@127: differential equations with mixed boundary conditions. (For some r2r cannam@127: kinds, notably the halfcomplex DFT and the DHT, such a separable cannam@127: product is somewhat problematic in more than one dimension, however, cannam@127: as is described below.) cannam@127:

cannam@127:

In the current version of FFTW, all r2r transforms except for the cannam@127: halfcomplex type are computed via pre- or post-processing of cannam@127: halfcomplex transforms, and they are therefore not as fast as they cannam@127: could be. Since most other general DCT/DST codes employ a similar cannam@127: algorithm, however, FFTW’s implementation should provide at least cannam@127: competitive performance. cannam@127:

cannam@127:
cannam@127:
cannam@127:

cannam@127: Previous: , Up: Tutorial   [Contents][Index]

cannam@127:
cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: