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

MKL's cosine transform for strided data

Divakar_V_
Beginner
137 Views
MKL has a cosine transform among its Trigonometric Transforms (Chapter 13 of the manual). The cosine transform is significantly faster than that of FFTW.

However, there is no documented way to apply cosine transform to strided data. In particular, suppose

a b a b a b a b a b a b ....

is a sequence of doubles. I want to apply a cosine transform to the a's and to the b's. Is there a way to do that?
0 Kudos
3 Replies
mecej4
Black Belt
137 Views
If you are calling from Fortran, you can use an array expression for the input argument.

In Fortran as well as C, you can, of course, extract the 'a's into one array, the 'b's into another and use such an array as the input argument.

You could put your data into a 2-D array:

a b
a b
a b

and pass each column to the FFT routine.
Divakar_V_
Beginner
137 Views
One can copy the interleaved data into two stride 1 arrays and use MKL, but that incurs a very significant penalty. If n=1024, copying will increase the cost of a single cosine transform (assuming data is not in cache but the copying area is in cache) by nearly 30%.
Gerald_H_
Beginner
137 Views

I'm glad I'm not the only one who is attempting to vectorize operations with interleaved data -- i.e. complex numbers.

Reply