Continuing fucking with FFTWcame across this gist which worked for me. Learned that importing ‘complex.h’ one could use expressions like double complex z1 = 1.0 + 3.0 * I; in plain C (taken from this stackoverflow answer). It’s C99. Same works in C++. Finally found out that failure last Friday was not because of complex.h being to included but because of my buffer overflow bug.

Examining fftw documentation found a term I havn’t heard before - row-major order for multidimensional array (sometimes called “C order”). Also exists a column-major order (sometimes called “Fortran order”).

TODO: check is it really that despite row-major or column-major order both can be accessed just by changing order of dimensions.