Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
- Incorrect result with both FFTW and MKL FFT

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted

vahid_a_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-26-2017
09:28 AM

121 Views

Hello everyone,

I've noticed that both MKL FFT and FFTW is giving me a wrong result while calculating 2D complex-to-complex BACKWARD FFT. I am attaching the source codes that I used on this forum to discuss it with the experts.

While the input array is :

1.0+0.0i 1.0+0.0i 1.0+0.0i 1.0+0.0i 1.0+0.0i 1.0+0.0i 1.0+0.0i 1.0+0.0i 1.0+0.0i

The forward transform should be:

9.0+0.0i 0.0+0.0i 0.0+0.0i 0.0+0.0i 0.0+0.0i 0.0+0.0i 0.0+0.0i 0.0+0.0i 0.0+0.0i

And the backward transform should be again the initial array. However, it is:

9.0+0.0i 9.0+0.0i 9.0+0.0i 9.0+0.0i 9.0+0.0i 9.0+0.0i 9.0+0.0i 9.0+0.0i 9.0+0.0i

I attached my test code here. Could you pls. let me know why this is happening?

Accepted Solutions

Highlighted

Zhen_Z_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-26-2017
09:15 PM

121 Views

Hi vahid,

If you would like get inverse of forward, you have to set backward scale factor. For you case, please set bscale to 1.0 / real(L(1)*L(2)), the result would be correct. For 1D, make sure fscale*bscale=1/len. For 2D, make sure fscale*bscale=1/ (col*row). If you would like to get similar matlab result for forward & backward, please set fscale=1/col, and bscale=1/row.

Best regards,

Fiona

2 Replies

Highlighted

vahid_a_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-26-2017
06:57 PM

121 Views

I have noticed that there is a * scale factor (\sigma)* in the original formulation of Discrete Fast Fourier (DFT) approach as it is implemented in Intel MKL here:

https://software.intel.com/en-us/mkl-developer-reference-c-fourier-transform-functions

In the above example array, we need to divide the array to some scaling factor to obtain the exact initial array. **How should we access to the value of the (\sigma) or the scaling factor?**

* Point 1:* It seems that the scaling factor is "1" when it is the forward transform. However, it changes during the backward transform.

* Point 2: *The implemented FFT formulation in MATLAB does not include any scaling factor!

Highlighted

Zhen_Z_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-26-2017
09:15 PM

122 Views

Hi vahid,

If you would like get inverse of forward, you have to set backward scale factor. For you case, please set bscale to 1.0 / real(L(1)*L(2)), the result would be correct. For 1D, make sure fscale*bscale=1/len. For 2D, make sure fscale*bscale=1/ (col*row). If you would like to get similar matlab result for forward & backward, please set fscale=1/col, and bscale=1/row.

Best regards,

Fiona

For more complete information about compiler optimizations, see our Optimization Notice.