Next: Real-to-Real Transform Kinds, Previous: Real-data DFT Array Format, Up: Basic Interface [Contents][Index]

#### 4.3.5 Real-to-Real Transforms

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

Plan a real input/output (r2r) transform of various kinds 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. A non-`NULL` plan is always returned by the basic interface unless you are using a customized FFTW configuration supporting a restricted set of transforms, or for size-1 `FFTW_REDFT00` kinds (which are not defined).

#### Arguments

- `rank` is the dimensionality of the transform (it should be the size of the arrays `*n` and `*kind`), and can be any non-negative integer. The ‘`_1d`’, ‘`_2d`’, and ‘`_3d`’ planners correspond to a `rank` of `1`, `2`, and `3`, respectively. A `rank` of zero is equivalent to a copy of one number from input to output.
- `n`, or `n0`/`n1`/`n2`, or `n[rank]`, respectively, gives the (physical) 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 generally 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.
  - - For a `REDFT00` or `RODFT00` transform kind in a dimension of size n, it is n-1 or n+1, respectively, that should be factorizable in the above form.
- `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.)
- `kind`, or `kind0`/`kind1`/`kind2`, or `kind[rank]`, is the kind of r2r transform used for the corresponding dimension. The valid kind constants are described in Real-to-Real Transform Kinds. In a multi-dimensional transform, what is computed is the separable product formed by taking each transform kind along the corresponding dimension, one dimension after another.
- `flags` is a bitwise OR (‘`|`’) of zero or more planner flags, as defined in Planner Flags.

Next: Real-to-Real Transform Kinds, Previous: Real-data DFT Array Format, Up: Basic Interface [Contents][Index]