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
- Software Development SDKs and Libraries
- Intel® oneAPI 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

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

300 Views

Incorrect result with both FFTW and MKL FFT

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?

1 Solution

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

300 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

Link Copied

2 Replies

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

300 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!

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

301 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

Topic Options

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

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