I wonder how the frequencies are associated to the output matrix elements after a 2d FFT in CCE format in C.

As I understand, for a real-to-complex FFT, I get the output as an array of y[M][N/2+1] complex numbers. Now, there is a conjugate-even symmetry in both dimensions. Accordingly, in C, only N/2+1 elements are stored in the N direction. My question is: how should the symmetry be understood in the M direction or in other words, how are the positive and negative frequencies are associated to the complex coefficients in the output array y?

An example might make it more clear. In 1D, the loop

int k;

double Y = 0.0;

for ( k = -N/2; k < N/2+N%2; k++ )

Y += y[abs(k)*2+0]*cos(2.0*PI*j/n*k) - SGN(k)*y[abs(k)*2+1]*sin(2.0*PI*j/n*k);

seems to correctly sum up in Y the approximate Fourier series, evaluated at 2.0*PI*j/n ,using the complex coefficients (stored in y in CCS format) after a 1D FFT.

The question is how can one construct a similar loop in 2D?

Thanks,

Jozsef