Chris@19: Chris@19:
Chris@19:Chris@19: Next: Column-major Format, Chris@19: Previous: Multi-dimensional Array Format, Chris@19: Up: Multi-dimensional Array Format Chris@19:
Chris@19: The multi-dimensional arrays passed to fftw_plan_dft
etcetera
Chris@19: are expected to be stored as a single contiguous block in
Chris@19: row-major order (sometimes called “C order”). Basically, this
Chris@19: means that as you step through adjacent memory locations, the first
Chris@19: dimension's index varies most slowly and the last dimension's index
Chris@19: varies most quickly.
Chris@19:
Chris@19:
To be more explicit, let us consider an array of rank d whose Chris@19: dimensions are n0 × n1 × n2 × … × nd-1. Now, we specify a location in the array by a Chris@19: sequence of d (zero-based) indices, one for each dimension: Chris@19: (i0, i1, i2,..., id-1). If the array is stored in row-major Chris@19: order, then this element is located at the position Chris@19: id-1 + nd-1 * (id-2 + nd-2 * (... + n1 * i0)). Chris@19: Chris@19:
Note that, for the ordinary complex DFT, each element of the array
Chris@19: must be of type fftw_complex
; i.e. a (real, imaginary) pair of
Chris@19: (double-precision) numbers.
Chris@19:
Chris@19:
In the advanced FFTW interface, the physical dimensions n from Chris@19: which the indices are computed can be different from (larger than) Chris@19: the logical dimensions of the transform to be computed, in order to Chris@19: transform a subset of a larger array. Chris@19: Note also that, in the advanced interface, the expression above is Chris@19: multiplied by a stride to get the actual array index—this is Chris@19: useful in situations where each element of the multi-dimensional array Chris@19: is actually a data structure (or another array), and you just want to Chris@19: transform a single field. In the basic interface, however, the stride Chris@19: is 1. Chris@19: Chris@19: Chris@19: Chris@19: Chris@19: