Plan Creation for Multi-dimensional Transforms
----------------------------------------------
#include <fftw.h>
fftwnd_plan fftwnd_create_plan(int rank, const int *n,
fftw_direction dir, int flags);
fftwnd_plan fftw2d_create_plan(int nx, int ny,
fftw_direction dir, int flags);
fftwnd_plan fftw3d_create_plan(int nx, int ny, int nz,
fftw_direction dir, int flags);
fftwnd_plan fftwnd_create_plan_specific(int rank, const int *n,
fftw_direction dir,
int flags,
fftw_complex *in, int istride,
fftw_complex *out, int ostride);
fftwnd_plan fftw2d_create_plan_specific(int nx, int ny,
fftw_direction dir,
int flags,
fftw_complex *in, int istride,
fftw_complex *out, int ostride);
fftwnd_plan fftw3d_create_plan_specific(int nx, int ny, int nz,
fftw_direction dir, int flags,
fftw_complex *in, int istride,
fftw_complex *out, int ostride);
The function `fftwnd_create_plan' creates a plan, which is a data
structure containing all the information that `fftwnd' needs in order
to compute a multi-dimensional Fourier transform. You can create as
many plans as you need, but only one plan for a given array size is
required (a plan can be reused many times). The functions
`fftw2d_create_plan' and `fftw3d_create_plan' are optional, alternative
interfaces to `fftwnd_create_plan' for two and three dimensions,
respectively.
`fftwnd_create_plan' returns a valid plan, or `NULL' if, for some
reason, the plan can't be created. This can happen if memory runs out
or if the arguments are invalid in some way (e.g. if `rank' < 0).
The `create_plan_specific' variants take as additional arguments
specific input/output arrays and their strides. For the last four
arguments, you should pass the arrays and strides that you will
eventually be passing to `fftwnd'. The resulting plans will be
optimized for those arrays and strides, although they may be used on
other arrays as well. Note: the contents of the in and out arrays are
*destroyed* by the specific planner (the initial contents are ignored,
so the arrays need not have been initialized). Note:Discussion on
Specific Plans, for a discussion on specific plans.
Arguments
.........
* `rank' is the dimensionality of the arrays to be transformed. It
can be any non-negative integer.
* `n' is a pointer to an array of `rank' integers, giving the size
of each dimension of the arrays to be transformed. These sizes,
which must be positive integers, correspond to the dimensions of
row-major arrays--i.e. `n[0]' is the size of the dimension whose
indices vary most slowly, and so on. (Note:Multi-dimensional
Array Format, for more information on row-major storage.) Note:Plan Creation for One-dimensional Transforms,
for more information regarding optimal array sizes.
* `nx' and `ny' in `fftw2d_create_plan' are positive integers
specifying the dimensions of the rank 2 array to be transformed.
i.e. they specify that the transform will operate on `nx x ny'
arrays in row-major order, where `nx' is the number of rows and
`ny' is the number of columns.
* `nx', `ny' and `nz' in `fftw3d_create_plan' are positive integers
specifying the dimensions of the rank 3 array to be transformed.
i.e. they specify that the transform will operate on `nx x ny x
nz' arrays in row-major order.
* `dir' is the sign of the exponent in the formula that defines the
Fourier transform. It can be -1 or +1. The aliases
`FFTW_FORWARD' and `FFTW_BACKWARD' are provided, where
`FFTW_FORWARD' stands for -1.
* `flags' is a boolean OR (`|') of zero or more of the following:
- `FFTW_MEASURE': this flag tells FFTW to find the optimal plan
by actually *computing* several FFTs and measuring their
execution time.
- `FFTW_ESTIMATE': do not run any FFT and provide a "reasonable"
plan (for a RISC processor with many registers). If neither
`FFTW_ESTIMATE' nor `FFTW_MEASURE' is provided, the default is
`FFTW_ESTIMATE'.
- `FFTW_OUT_OF_PLACE': produce a plan assuming that the input
and output arrays will be distinct (this is the default).
- `FFTW_IN_PLACE': produce a plan assuming that you want to
perform the transform in-place. (Unlike the one-dimensional
transform, this "really" (1) performs the transform
in-place.) Note that, if you want to perform in-place
transforms, you *must* use a plan created with this option.
The default mode of operation is `FFTW_OUT_OF_PLACE'.
- `FFTW_USE_WISDOM': use any `wisdom' that is available to help
in the creation of the plan. (Note:Words of Wisdom.) This
can greatly speed the creation of plans, especially with the
`FFTW_MEASURE' option. `FFTW_ESTIMATE' plans can also take
advantage of `wisdom' to produce a more optimal plan (based
on past measurements) than the estimation heuristic would
normally generate. When the `FFTW_MEASURE' option is used,
new `wisdom' will also be generated if the current transform
size is not completely understood by existing `wisdom'. Note
that the same `wisdom' is shared between one-dimensional and
multi-dimensional transforms.
* `in', `out', `istride', `ostride' (only for the
`_create_plan_specific' variants): see corresponding arguments in
the description of `fftwnd'. (Note:Computing the
Multi-dimensional Transform.)
---------- Footnotes ----------
(1) `fftwnd' actually may use some temporary storage (hidden in the
plan), but this storage space is only the size of the largest dimension
of the array, rather than being as big as the entire array. (Unless
you use `fftwnd' to perform one-dimensional transforms, in which case
the temporary storage required for in-place transforms *is* as big as
the entire array.)