Node:Row-major Format, Next:Column-major Format, Previous:Multi-dimensional Array Format, Up:Multi-dimensional Array Format

The multi-dimensional arrays passed to `fftw_plan_dft`

etcetera
are expected to be stored as a single contiguous block in
row-major order (sometimes called "C order"). Basically, this
means that as you step through adjacent memory locations, the first
dimension's index varies most slowly and the last dimension's index
varies most quickly.

To be more explicit, let us consider an array of rank d whose
dimensions are n_{1} x n_{2} x n_{3} x ... x n_{d}
. Now, we specify a location in the array by a
sequence of (zero-based) indices, one for each dimension:
(i_{1}, i_{2}, i_{3},..., i_{d}).
If the array is stored in row-major
order, then this element is located at the position
i_{d} + n_{d} * (i_{d-1} + n_{d-1} * (... + n_{2} * i_{1})).

Note that, for the ordinary complex DFT, each element of the array
must be of type `fftw_complex`

; i.e. a (real, imaginary) pair of
(double-precision) numbers.

In the advanced FFTW interface, the physical dimensions n from which the indices are computed can be different from (larger than) the logical dimensions of the transform to be computed, in order to transform a subset of a larger array. Note also that, in the advanced interface, the expression above is multiplied by a stride to get the actual array index--this is useful in situations where each element of the multi-dimensional array is actually a data structure (or another array), and you just want to transform a single field. In the basic interface, however, the stride is 1.