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
- FFT forward and backward test

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

Bo_Q_

Beginner

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

04-24-2014
08:01 AM

112 Views

FFT forward and backward test

Hi,

I am testing the FFT routines in MKL library. Following the example code, I was able to do 1D forward FFT for an array input supplied by a text file. Then a backward FFT is performed and the result is saved in another text file.

Theoretically, the output of the backward FFT should be the same as the input array. But what I get is not. The real part is scaled by n (number of points) and the imaginary part is pure zero.

The attached files are the code, input file and output file. Please help me through. Thanks.

Bo

Link Copied

3 Replies

Evarist_F_Intel

Employee

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

04-24-2014
08:04 PM

112 Views

Hi,

At first, I want to say about scaling. If you perform Forward and then Backward DFT you will get source array scaled by N, where N is the size of the array. It is just a property of DFT. If you want to perform unitary DFT, I should set DFTI_FORWARD_SCALE and DFTI_BACKWARD_SCALE to 1/sqrt(N) using DftiSetValue. Another way to obtain source array without scaling is to set DFTI_BACKWARD_SCALE to 1/N, and that is it.

I tried to run your code and got the problem with reading the input array: the program reads real part, but doesn't read imaginary part (looks like the problem is in format reading and commas). If I either remove commas from INPUT.txt or replace [fortran] READ(10,'(E10.3, E10.3)') DR(I), DI(I) [/fortran] with [fortran] READ(10,*) DR(I), DI(I) [/fortran] everything goes fine

Bo_Q_

Beginner

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

04-25-2014
10:25 PM

112 Views

Thanks! Really appreciate your help!

Evarist_F_Intel

Employee

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

04-26-2014
12:35 AM

112 Views

You are welcome!

- 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.