Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: FFTW 3.3.8: Advanced Complex DFTs Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: Chris@82:
Chris@82:

Chris@82: Next: , Previous: , Up: Advanced Interface   [Contents][Index]

Chris@82:
Chris@82:
Chris@82: Chris@82:

4.4.1 Advanced Complex DFTs

Chris@82: Chris@82:
Chris@82:
fftw_plan fftw_plan_many_dft(int rank, const int *n, int howmany,
Chris@82:                              fftw_complex *in, const int *inembed,
Chris@82:                              int istride, int idist,
Chris@82:                              fftw_complex *out, const int *onembed,
Chris@82:                              int ostride, int odist,
Chris@82:                              int sign, unsigned flags);
Chris@82: 
Chris@82: Chris@82: Chris@82:

This routine plans multiple multidimensional complex DFTs, and it Chris@82: extends the fftw_plan_dft routine (see Complex DFTs) to Chris@82: compute howmany transforms, each having rank rank and size Chris@82: n. In addition, the transform data need not be contiguous, but Chris@82: it may be laid out in memory with an arbitrary stride. To account for Chris@82: these possibilities, fftw_plan_many_dft adds the new parameters Chris@82: howmany, {i,o}nembed, Chris@82: {i,o}stride, and Chris@82: {i,o}dist. The FFTW basic interface Chris@82: (see Complex DFTs) provides routines specialized for ranks 1, 2, Chris@82: and 3, but the advanced interface handles only the general-rank Chris@82: case. Chris@82:

Chris@82:

howmany is the (nonnegative) number of transforms to compute. The resulting Chris@82: plan computes howmany transforms, where the input of the Chris@82: k-th transform is at location in+k*idist (in C pointer Chris@82: arithmetic), and its output is at location out+k*odist. Plans Chris@82: obtained in this way can often be faster than calling FFTW multiple Chris@82: times for the individual transforms. The basic fftw_plan_dft Chris@82: interface corresponds to howmany=1 (in which case the dist Chris@82: parameters are ignored). Chris@82: Chris@82: Chris@82:

Chris@82: Chris@82:

Each of the howmany transforms has rank rank and size Chris@82: n, as in the basic interface. In addition, the advanced Chris@82: interface allows the input and output arrays of each transform to be Chris@82: row-major subarrays of larger rank-rank arrays, described by Chris@82: inembed and onembed parameters, respectively. Chris@82: {i,o}nembed must be arrays of length rank, Chris@82: and n should be elementwise less than or equal to Chris@82: {i,o}nembed. Passing NULL for an Chris@82: nembed parameter is equivalent to passing n (i.e. same Chris@82: physical and logical dimensions, as in the basic interface.) Chris@82:

Chris@82:

The stride parameters indicate that the j-th element of Chris@82: the input or output arrays is located at j*istride or Chris@82: j*ostride, respectively. (For a multi-dimensional array, Chris@82: j is the ordinary row-major index.) When combined with the Chris@82: k-th transform in a howmany loop, from above, this means Chris@82: that the (j,k)-th element is at j*stride+k*dist. Chris@82: (The basic fftw_plan_dft interface corresponds to a stride of 1.) Chris@82: Chris@82:

Chris@82: Chris@82:

For in-place transforms, the input and output stride and Chris@82: dist parameters should be the same; otherwise, the planner may Chris@82: return NULL. Chris@82:

Chris@82:

Arrays n, inembed, and onembed are not used after Chris@82: this function returns. You can safely free or reuse them. Chris@82:

Chris@82:

Examples: Chris@82: One transform of one 5 by 6 array contiguous in memory: Chris@82:

Chris@82:
   int rank = 2;
Chris@82:    int n[] = {5, 6};
Chris@82:    int howmany = 1;
Chris@82:    int idist = odist = 0; /* unused because howmany = 1 */
Chris@82:    int istride = ostride = 1; /* array is contiguous in memory */
Chris@82:    int *inembed = n, *onembed = n;
Chris@82: 
Chris@82: Chris@82:

Transform of three 5 by 6 arrays, each contiguous in memory, Chris@82: stored in memory one after another: Chris@82:

Chris@82:
   int rank = 2;
Chris@82:    int n[] = {5, 6};
Chris@82:    int howmany = 3;
Chris@82:    int idist = odist = n[0]*n[1]; /* = 30, the distance in memory
Chris@82:                                      between the first element
Chris@82:                                      of the first array and the
Chris@82:                                      first element of the second array */
Chris@82:    int istride = ostride = 1; /* array is contiguous in memory */
Chris@82:    int *inembed = n, *onembed = n;
Chris@82: 
Chris@82: Chris@82:

Transform each column of a 2d array with 10 rows and 3 columns: Chris@82:

Chris@82:
   int rank = 1; /* not 2: we are computing 1d transforms */
Chris@82:    int n[] = {10}; /* 1d transforms of length 10 */
Chris@82:    int howmany = 3;
Chris@82:    int idist = odist = 1;
Chris@82:    int istride = ostride = 3; /* distance between two elements in 
Chris@82:                                  the same column */
Chris@82:    int *inembed = n, *onembed = n;
Chris@82: 
Chris@82: Chris@82:
Chris@82:
Chris@82:

Chris@82: Next: , Previous: , Up: Advanced Interface   [Contents][Index]

Chris@82:
Chris@82: Chris@82: Chris@82: Chris@82: Chris@82: