Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6981 Discussions

How to use DFT to compute a cosine Fourier Tranform

Chang_Lei
Beginner
467 Views
As the title.
Best regards!
0 Kudos
4 Replies
Dmitry_B_Intel
Employee
467 Views
Hi Chang,

Intel MKL 10.2 and later versions support major part of FFTW3 interface. In particular 1D trigonometric transforms are supported. Example:

#include "fftw3.h" /* compile with -I$mkl/include/fftw */
fftw_plan plan = fftw_plan_r2r_1d(N,x,y,FFTW_REDFT01,FFTW_MEASURE);
...

For details see fftw documentation.

Thanks
Dima
0 Kudos
Chang_Lei
Beginner
467 Views
Thanks.
Current version of MKL I'm using is CMKL 9.0, does that mean I must update my MKL to 10.2 or later versions?
And another question is: what's themain benefits of using MKL FFTwwrapperscomparing with using FFTwdirectly? Can I run it with muti-threads(OpenMP threads)?
With Best Regards!
Chang lei
0 Kudos
Dmitry_B_Intel
Employee
467 Views
Hi Chang,

Intel MKL 9.0 doesn't provide wrappers for trigonometric transforms. If you want to use MKL FFTW3 interfaces for this, you should upgrade to MKL 10.2 or later versions. Alternatively, with MKL 9.0 you can use trigonometric transforms with a special interface (look into MKL 9.0 documentation, section "Partial Differential Equations Support" -> "Trigonometric Transforms Routines"). Examples of using these can be found in directory examples/pdett of your MKL installation.

To the question aboutbenefits,Intel MKL provides performance optimized functions, and this is the main benefit.However, if youare concerned withportability,then a more popular interface may be the choice, such as FFTW.

OpenMP threads should be harnessedautomatically, provided that you linked your application with proper (threaded) library,perform recommended call sequence to employ threads [e.g. FFTW interface requires a call tofftw_plan_with_nthreads() be made in advance], and/or set environment [e.g. OMP_NUM_THREADS=4]. Details should be found inthe product documentation.

Thanks
Dima
0 Kudos
Chang_Lei
Beginner
467 Views
It's very helpful and clear for me.
Thanks for yourpatiently reply. That's so nice of you.
0 Kudos
Reply