cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: FFTW 3.3.8: Complex Multi-Dimensional DFTs cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167:
cannam@167:

cannam@167: Next: , Previous: , Up: Tutorial   [Contents][Index]

cannam@167:
cannam@167:
cannam@167: cannam@167:

2.2 Complex Multi-Dimensional DFTs

cannam@167: cannam@167:

Multi-dimensional transforms work much the same way as one-dimensional cannam@167: transforms: you allocate arrays of fftw_complex (preferably cannam@167: using fftw_malloc), create an fftw_plan, execute it as cannam@167: many times as you want with fftw_execute(plan), and clean up cannam@167: with fftw_destroy_plan(plan) (and fftw_free). cannam@167:

cannam@167:

FFTW provides two routines for creating plans for 2d and 3d transforms, cannam@167: and one routine for creating plans of arbitrary dimensionality. cannam@167: The 2d and 3d routines have the following signature: cannam@167:

cannam@167:
fftw_plan fftw_plan_dft_2d(int n0, int n1,
cannam@167:                            fftw_complex *in, fftw_complex *out,
cannam@167:                            int sign, unsigned flags);
cannam@167: fftw_plan fftw_plan_dft_3d(int n0, int n1, int n2,
cannam@167:                            fftw_complex *in, fftw_complex *out,
cannam@167:                            int sign, unsigned flags);
cannam@167: 
cannam@167: cannam@167: cannam@167: cannam@167:

These routines create plans for n0 by n1 two-dimensional cannam@167: (2d) transforms and n0 by n1 by n2 3d transforms, cannam@167: respectively. All of these transforms operate on contiguous arrays in cannam@167: the C-standard row-major order, so that the last dimension has the cannam@167: fastest-varying index in the array. This layout is described further in cannam@167: Multi-dimensional Array Format. cannam@167:

cannam@167:

FFTW can also compute transforms of higher dimensionality. In order to cannam@167: avoid confusion between the various meanings of the the word cannam@167: “dimension”, we use the term rank cannam@167: cannam@167: to denote the number of independent indices in an array.2 For cannam@167: example, we say that a 2d transform has rank 2, a 3d transform has cannam@167: rank 3, and so on. You can plan transforms of arbitrary rank by cannam@167: means of the following function: cannam@167:

cannam@167:
cannam@167:
fftw_plan fftw_plan_dft(int rank, const int *n,
cannam@167:                         fftw_complex *in, fftw_complex *out,
cannam@167:                         int sign, unsigned flags);
cannam@167: 
cannam@167: cannam@167: cannam@167:

Here, n is a pointer to an array n[rank] denoting an cannam@167: n[0] by n[1] by … by n[rank-1] transform. cannam@167: Thus, for example, the call cannam@167:

cannam@167:
fftw_plan_dft_2d(n0, n1, in, out, sign, flags);
cannam@167: 
cannam@167:

is equivalent to the following code fragment: cannam@167:

cannam@167:
int n[2];
cannam@167: n[0] = n0;
cannam@167: n[1] = n1;
cannam@167: fftw_plan_dft(2, n, in, out, sign, flags);
cannam@167: 
cannam@167:

fftw_plan_dft is not restricted to 2d and 3d transforms, cannam@167: however, but it can plan transforms of arbitrary rank. cannam@167:

cannam@167:

You may have noticed that all the planner routines described so far cannam@167: have overlapping functionality. For example, you can plan a 1d or 2d cannam@167: transform by using fftw_plan_dft with a rank of 1 cannam@167: or 2, or even by calling fftw_plan_dft_3d with n0 cannam@167: and/or n1 equal to 1 (with no loss in efficiency). This cannam@167: pattern continues, and FFTW’s planning routines in general form a cannam@167: “partial order,” sequences of cannam@167: cannam@167: interfaces with strictly increasing generality but correspondingly cannam@167: greater complexity. cannam@167:

cannam@167:

fftw_plan_dft is the most general complex-DFT routine that we cannam@167: describe in this tutorial, but there are also the advanced and guru interfaces, cannam@167: cannam@167: cannam@167: which allow one to efficiently combine multiple/strided transforms cannam@167: into a single FFTW plan, transform a subset of a larger cannam@167: multi-dimensional array, and/or to handle more general complex-number cannam@167: formats. For more information, see FFTW Reference. cannam@167:

cannam@167:
cannam@167:
cannam@167:

Footnotes

cannam@167: cannam@167:

(2)

cannam@167:

The cannam@167: term “rank” is commonly used in the APL, FORTRAN, and Common Lisp cannam@167: traditions, although it is not so common in the C world.

cannam@167:
cannam@167:
cannam@167:
cannam@167:

cannam@167: Next: , Previous: , Up: Tutorial   [Contents][Index]

cannam@167:
cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: