cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: FFTW 3.3.8: Row-major Format cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: cannam@167:
cannam@167:

cannam@167: Next: , Previous: , Up: Multi-dimensional Array Format   [Contents][Index]

cannam@167:
cannam@167:
cannam@167: cannam@167:

3.2.1 Row-major Format

cannam@167: cannam@167: cannam@167:

The multi-dimensional arrays passed to fftw_plan_dft etcetera cannam@167: are expected to be stored as a single contiguous block in cannam@167: row-major order (sometimes called “C order”). Basically, this cannam@167: means that as you step through adjacent memory locations, the first cannam@167: dimension’s index varies most slowly and the last dimension’s index cannam@167: varies most quickly. cannam@167:

cannam@167:

To be more explicit, let us consider an array of rank d whose cannam@167: dimensions are n0 × n1 × n2 × … × nd-1 cannam@167: . Now, we specify a location in the array by a cannam@167: sequence of d (zero-based) indices, one for each dimension: cannam@167: (i0, i1, i2,..., id-1). cannam@167: If the array is stored in row-major cannam@167: order, then this element is located at the position cannam@167: id-1 + nd-1 * (id-2 + nd-2 * (... + n1 * i0)). cannam@167:

cannam@167:

Note that, for the ordinary complex DFT, each element of the array cannam@167: must be of type fftw_complex; i.e. a (real, imaginary) pair of cannam@167: (double-precision) numbers. cannam@167:

cannam@167:

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

cannam@167: cannam@167: cannam@167: cannam@167: cannam@167: