FFTW 3.3.8: Complex DFTs

Next: Planner Flags, Previous: Basic Interface, Up: Basic Interface [Contents][Index]

#### 4.3.1 Complex DFTs

    fftw_plan fftw_plan_dft_1d(int n0,
                               fftw_complex *in, fftw_complex *out,
                               int sign, unsigned flags);
    fftw_plan fftw_plan_dft_2d(int n0, int n1,
                               fftw_complex *in, fftw_complex *out,
                               int sign, unsigned flags);
    fftw_plan fftw_plan_dft_3d(int n0, int n1, int n2,
                               fftw_complex *in, fftw_complex *out,
                               int sign, unsigned flags);
    fftw_plan fftw_plan_dft(int rank, const int *n,
                            fftw_complex *in, fftw_complex *out,
                            int sign, unsigned flags);

Plan a complex input/output discrete Fourier transform (DFT) in zero or more dimensions, returning an `fftw_plan` (see Using Plans).

Once you have created a plan for a certain transform type and parameters, then creating another plan of the same type and parameters, but for different arrays, is fast and shares constant data with the first plan (if it still exists).

The planner returns `NULL` if the plan cannot be created. In the standard FFTW distribution, the basic interface is guaranteed to return a non-`NULL` plan. A plan may be `NULL`, however, if you are using a customized FFTW configuration supporting a restricted set of transforms.

#### Arguments

- `rank` is the rank of the transform (it should be the size of the array `*n`), and can be any non-negative integer. (See Complex Multi-Dimensional DFTs, for the definition of “rank”.) The ‘`_1d`’, ‘`_2d`’, and ‘`_3d`’ planners correspond to a `rank` of `1`, `2`, and `3`, respectively. The rank may be zero, which is equivalent to a rank-1 transform of size 1, i.e. a copy of one number from input to output.
- `n0`, `n1`, `n2`, or `n[0..rank-1]` (as appropriate for each routine) specify the size of the transform dimensions. They can be any positive integer.
  - - Multi-dimensional arrays are stored in row-major order with dimensions: `n0` x `n1`; or `n0` x `n1` x `n2`; or `n[0]` x `n[1]` x ... x `n[rank-1]`. See Multi-dimensional Array Format.
  - - FFTW is best at handling sizes of the form 2a 3b 5c 7d 11e 13f, where e+f is either 0 or 1, and the other exponents are arbitrary. Other sizes are computed by means of a slow, general-purpose algorithm (which nevertheless retains O(n log n) performance even for prime sizes). It is possible to customize FFTW for different array sizes; see Installation and Customization. Transforms whose sizes are powers of 2 are especially fast.
- `in` and `out` point to the input and output arrays of the transform, which may be the same (yielding an in-place transform). These arrays are overwritten during planning, unless `FFTW_ESTIMATE` is used in the flags. (The arrays need not be initialized, but they must be allocated.)

  If `in == out`, the transform is in-place and the input array is overwritten. If `in != out`, the two arrays must not overlap (but FFTW does not check for this condition).

- `sign` is the sign of the exponent in the formula that defines the Fourier transform. It can be -1 (= `FFTW_FORWARD`) or +1 (= `FFTW_BACKWARD`).
- `flags` is a bitwise OR (‘`|`’) of zero or more planner flags, as defined in Planner Flags.

FFTW computes an unnormalized transform: computing a forward followed by a backward transform (or vice versa) will result in the original data multiplied by the size of the transform (the product of the dimensions). For more information, see What FFTW Really Computes.

Next: Planner Flags, Previous: Basic Interface, Up: Basic Interface [Contents][Index]