Chris@19: Chris@19:
Chris@19:Chris@19: Next: Advanced Real-data DFTs, Chris@19: Previous: Advanced Interface, Chris@19: Up: Advanced Interface Chris@19:
fftw_plan fftw_plan_many_dft(int rank, const int *n, int howmany, Chris@19: fftw_complex *in, const int *inembed, Chris@19: int istride, int idist, Chris@19: fftw_complex *out, const int *onembed, Chris@19: int ostride, int odist, Chris@19: int sign, unsigned flags); Chris@19:Chris@19:
Chris@19: This routine plans multiple multidimensional complex DFTs, and it
Chris@19: extends the fftw_plan_dft
routine (see Complex DFTs) to
Chris@19: compute howmany
transforms, each having rank rank
and size
Chris@19: n
. In addition, the transform data need not be contiguous, but
Chris@19: it may be laid out in memory with an arbitrary stride. To account for
Chris@19: these possibilities, fftw_plan_many_dft
adds the new parameters
Chris@19: howmany
, {i
,o
}nembed
,
Chris@19: {i
,o
}stride
, and
Chris@19: {i
,o
}dist
. The FFTW basic interface
Chris@19: (see Complex DFTs) provides routines specialized for ranks 1, 2,
Chris@19: and 3, but the advanced interface handles only the general-rank
Chris@19: case.
Chris@19:
Chris@19:
howmany
is the number of transforms to compute. The resulting
Chris@19: plan computes howmany
transforms, where the input of the
Chris@19: k
-th transform is at location in+k*idist
(in C pointer
Chris@19: arithmetic), and its output is at location out+k*odist
. Plans
Chris@19: obtained in this way can often be faster than calling FFTW multiple
Chris@19: times for the individual transforms. The basic fftw_plan_dft
Chris@19: interface corresponds to howmany=1
(in which case the dist
Chris@19: parameters are ignored).
Chris@19:
Chris@19:
Chris@19:
Each of the howmany
transforms has rank rank
and size
Chris@19: n
, as in the basic interface. In addition, the advanced
Chris@19: interface allows the input and output arrays of each transform to be
Chris@19: row-major subarrays of larger rank-rank
arrays, described by
Chris@19: inembed
and onembed
parameters, respectively.
Chris@19: {i
,o
}nembed
must be arrays of length rank
,
Chris@19: and n
should be elementwise less than or equal to
Chris@19: {i
,o
}nembed
. Passing NULL
for an
Chris@19: nembed
parameter is equivalent to passing n
(i.e. same
Chris@19: physical and logical dimensions, as in the basic interface.)
Chris@19:
Chris@19:
The stride
parameters indicate that the j
-th element of
Chris@19: the input or output arrays is located at j*istride
or
Chris@19: j*ostride
, respectively. (For a multi-dimensional array,
Chris@19: j
is the ordinary row-major index.) When combined with the
Chris@19: k
-th transform in a howmany
loop, from above, this means
Chris@19: that the (j
,k
)-th element is at j*stride+k*dist
.
Chris@19: (The basic fftw_plan_dft
interface corresponds to a stride of 1.)
Chris@19:
Chris@19:
Chris@19:
For in-place transforms, the input and output stride
and
Chris@19: dist
parameters should be the same; otherwise, the planner may
Chris@19: return NULL
.
Chris@19:
Chris@19:
Arrays n
, inembed
, and onembed
are not used after
Chris@19: this function returns. You can safely free or reuse them.
Chris@19:
Chris@19:
Examples: Chris@19: One transform of one 5 by 6 array contiguous in memory: Chris@19:
int rank = 2; Chris@19: int n[] = {5, 6}; Chris@19: int howmany = 1; Chris@19: int idist = odist = 0; /* unused because howmany = 1 */ Chris@19: int istride = ostride = 1; /* array is contiguous in memory */ Chris@19: int *inembed = n, *onembed = n; Chris@19:Chris@19:
Transform of three 5 by 6 arrays, each contiguous in memory, Chris@19: stored in memory one after another: Chris@19:
int rank = 2; Chris@19: int n[] = {5, 6}; Chris@19: int howmany = 3; Chris@19: int idist = odist = n[0]*n[1]; /* = 30, the distance in memory Chris@19: between the first element Chris@19: of the first array and the Chris@19: first element of the second array */ Chris@19: int istride = ostride = 1; /* array is contiguous in memory */ Chris@19: int *inembed = n, *onembed = n; Chris@19:Chris@19:
Transform each column of a 2d array with 10 rows and 3 columns: Chris@19:
int rank = 1; /* not 2: we are computing 1d transforms */ Chris@19: int n[] = {10}; /* 1d transforms of length 10 */ Chris@19: int howmany = 3; Chris@19: int idist = odist = 1; Chris@19: int istride = ostride = 3; /* distance between two elements in Chris@19: the same column */ Chris@19: int *inembed = n, *onembed = n; Chris@19:Chris@19: Chris@19: Chris@19: