# 1D - FFT

## 1D - FFT

Hi,

I am a newbie using the FFT, I have some question about the input and output data format using the FFT Functions.

```  DFTI_DESCRIPTOR *my_desc_handle;
long status;
status = DftiCreateDescriptor( &my_desc_handle, DFTI_SINGLE, DFTI_REAL, 1, N);
status = DftiCommitDescriptor( my_desc_handle);
status = DftiComputeForward( my_desc_handle, y);
status = DftiFreeDescriptor( &my_desc_handle );```

Well, my input data y is real. After the transformation y contains not only real but also imaginary data. Is there a workaround ?

thx

6 posts / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.

Hi,

It depends on what you need from the spectrum y. If you want to discard the phase and use the power, you should use the magnitude (sqrt(re^2+im^2)) of the y's complex numbers.
Alternatively, if you needa real-to-real transform, look into trigonometric transforms section of MKL Refernce Manual.

Dima

Hi,

It depends on what you need from the spectrum y. If you want to discard the phase and use the power, you should use the magnitude (sqrt(re^2+im^2)) of the y's complex numbers.
Alternatively, if you needa real-to-real transform, look into trigonometric transforms section of MKL Reference Manual.

Dima

Quoting - sicb0161
Hi,

I am a newbie using the FFT, I have some question about the input and output data format using the FFT Functions.

```  DFTI_DESCRIPTOR *my_desc_handle;
long status;
status = DftiCreateDescriptor( &my_desc_handle, DFTI_SINGLE, DFTI_REAL, 1, N);
status = DftiCommitDescriptor( my_desc_handle);
status = DftiComputeForward( my_desc_handle, y);
status = DftiFreeDescriptor( &my_desc_handle );```

Well, my input data y is real. After the transformation y contains not only real but also imaginary data. Is there a workaround ?

thx

Hi,

if I recall correctly you need to use DFTISetValue and select (from many) options you need, say, something along the lines:

```! set packed format for output complex conjugate-symmetric data
status%flag=DFTISetValue(desc_handle, ....., .....)```

where ..... go for named constants. (for example DFTI_REAL_REAL)

Take a look at Named Constants and storage schemes. I believe you'll find many good examples on disk.

A.

Quoting - Dmitry Baksheev (Intel)

Hi,

It depends on what you need from the spectrum y. If you want to discard the phase and use the power, you should use the magnitude (sqrt(re^2+im^2)) of the y's complex numbers.
Alternatively, if you needa real-to-real transform, look into trigonometric transforms section of MKL Refernce Manual.

Dima

Thx Dima ,

Hi, yes I could do so, but I only want to have the real part of y. After computing the FFT, y contains imaginary and real data. To be more precise :

```y[i] = (real part) if i = even,
(imag part) if i = odd.```

But y is only of length n , thus only containing half the data.

Thx

Right, for size=N real-to complex transform the y contains only N/2+1 complex values. The remaining values can be restored using conjugate-even symmetry of y: y[N-n]=conj(y[n]).
Dima