# 2D cuFFT Real2Complex How to retrieve "missing" coefficients?

Hi,

We know that cufftExecR2C() returns only the non-redundant FFT complex coefficients, due to simmetry in the Fourier transform of a real function.

For a 1D transform, the expression for the simmetry should be, AFAIK:

F(k) = F(n-k)*

Now: for a 2D R2C transform, say of a WxH real matrix, cufftExecR2C() returns a Wx(H/2 + 1) complex matrix, with non-redundant coefficients only.

What’s the formula to “fill in” the missing coefficients and have a complete WxH transformed matrix?
It’s not so trivial, for me at least, to figure out the right simmetry for 2D. :blink:

Fernando

To clarify, let’s have an example.

``````Input:

1  2  3  4

4  6  7  4

6  7  8  8

8  4  5  5

2D FFT (by Matlab):

82            -4+2i     2         -4-2i

-19+1i       -3+7i    -1+3i     3+5i

-4              -4+4i   -8          -4-4i

-19-1i         3-5i     -1-3i      -3-7i

2D cufftR2C:

82             -4+2i     2         -19+1i

-3+7i          -1+3i   -4          -4+4i

-8              -19-1i    3-5i       -1-3i
``````

I can’t see a trivial relation between Matlab’s and cuFFT’s outputs.

Things get more complicated with odd-sized matrices (i.e. 5x5, 7x7…). Fernando

Hi, Have you had any luck in solving this problem? If so, please let me know. I am faced with a similar problem and am considering rewriting an FFT algorithm (which I do not want to) because I havent been able to figure out how to get back the missing values and unjumble the CUFFT results. Thanks