d@0: d@0: d@0: Fixed-size Arrays in C - FFTW 3.2.1 d@0: d@0: d@0: d@0: d@0: d@0: d@0: d@0: d@0: d@0: d@0: d@0: d@0: d@0:
d@0:

d@0: d@0: d@0: Next: , d@0: Previous: Column-major Format, d@0: Up: Multi-dimensional Array Format d@0:


d@0:
d@0: d@0:

3.2.3 Fixed-size Arrays in C

d@0: d@0:

d@0: A multi-dimensional array whose size is declared at compile time in C d@0: is already in row-major order. You don't have to do anything d@0: special to transform it. For example: d@0: d@0:

     {
d@0:           fftw_complex data[N0][N1][N2];
d@0:           fftw_plan plan;
d@0:           ...
d@0:           plan = fftw_plan_dft_3d(N0, N1, N2, &data[0][0][0], &data[0][0][0],
d@0:                                   FFTW_FORWARD, FFTW_ESTIMATE);
d@0:           ...
d@0:      }
d@0: 
d@0:

This will plan a 3d in-place transform of size N0 x N1 x N2. d@0: Notice how we took the address of the zero-th element to pass to the d@0: planner (we could also have used a typecast). d@0: d@0:

However, we tend to discourage users from declaring their d@0: arrays in this way, for two reasons. First, this allocates the array d@0: on the stack (“automatic” storage), which has a very limited size on d@0: most operating systems (declaring an array with more than a few d@0: thousand elements will often cause a crash). (You can get around this d@0: limitation on man1 systems by declaring the array as d@0: static and/or global, but that has its own drawbacks.) d@0: Second, it may not optimally align the array for use with a SIMD d@0: FFTW (see SIMD alignment and fftw_malloc). Instead, we recommend d@0: using fftw_malloc, as described below. d@0: d@0: d@0: d@0: