Node:Real-data DFTs, Next:Real-data DFT Array Format, Previous:Planner Flags, Up:Basic Interface
fftw_plan fftw_plan_dft_r2c_1d(int n, double *in, fftw_complex *out, unsigned flags); fftw_plan fftw_plan_dft_r2c_2d(int nx, int ny, double *in, fftw_complex *out, unsigned flags); fftw_plan fftw_plan_dft_r2c_3d(int nx, int ny, int nz, double *in, fftw_complex *out, unsigned flags); fftw_plan fftw_plan_dft_r2c(int rank, const int *n, double *in, fftw_complex *out, unsigned flags);
Plan a real-input/complex-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. A
NULL plan is always returned by the basic interface unless
you are using a customized FFTW configuration supporting a restricted
set of transforms, or if you use the
with a multi-dimensional out-of-place c2r transform (see below).
rankis the dimensionality of the transform (it should be the size of the array
*n), and can be any non-negative integer. The
_3dplanners correspond to a
3, respectively. A
rankof zero is equivalent to a transform of size 1, i.e. a copy of one number (with zero imaginary part) from input to output.
n[rank], respectively, gives the size of the logical transform dimensions. They can be any positive integer. This is different in general from the physical array dimensions, which are described in Real-data DFT Array Format.
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, and it is generally beneficial for the last dimension of an r2c/c2r transform to be even.
outpoint 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_ESTIMATEis used in the flags. (The arrays need not be initialized, but they must be allocated.) For an in-place transform, it is important to remember that the real array will require padding, described in Real-data DFT Array Format.
flagsis a bitwise OR (
|) of zero or more planner flags, as defined in Planner Flags.
The inverse transforms, taking complex input (storing the non-redundant
half of a logically Hermitian array) to real output, are given by:
fftw_plan fftw_plan_dft_c2r_1d(int n, fftw_complex *in, double *out, unsigned flags); fftw_plan fftw_plan_dft_c2r_2d(int nx, int ny, fftw_complex *in, double *out, unsigned flags); fftw_plan fftw_plan_dft_c2r_3d(int nx, int ny, int nz, fftw_complex *in, double *out, unsigned flags); fftw_plan fftw_plan_dft_c2r(int rank, const int *n, fftw_complex *in, double *out, unsigned flags);
The arguments are the same as for the r2c transforms, except that the input and output data formats are reversed.
FFTW computes an unnormalized transform: computing an r2c followed by a
c2r transform (or vice versa) will result in the original data
multiplied by the size of the transform (the product of the logical
An r2c transform produces the same output as a
complex DFT of the same input, and a c2r transform is correspondingly
FFTW_BACKWARD. For more information, see What FFTW Really Computes.