Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: FFTW 3.3.5: Complex Multi-Dimensional DFTs Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42:
Chris@42:

Chris@42: Next: , Previous: , Up: Tutorial   [Contents][Index]

Chris@42:
Chris@42:
Chris@42: Chris@42:

2.2 Complex Multi-Dimensional DFTs

Chris@42: Chris@42:

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

Chris@42:

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

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

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

Chris@42:

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

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

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

Chris@42:
fftw_plan_dft_2d(n0, n1, in, out, sign, flags);
Chris@42: 
Chris@42:

is equivalent to the following code fragment: Chris@42:

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

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

Chris@42:

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

Chris@42:

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

Chris@42:
Chris@42:
Chris@42:

Footnotes

Chris@42: Chris@42:

(2)

Chris@42:

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

Chris@42:
Chris@42:
Chris@42:
Chris@42:

Chris@42: Next: , Previous: , Up: Tutorial   [Contents][Index]

Chris@42:
Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: