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

MKL's cosine transform for strided data

Anonymous
Not applicable
364 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
Honored Contributor III
364 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.
0 Kudos
Anonymous
Not applicable
364 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%.
0 Kudos
Gerald_H_
Beginner
364 Views

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

0 Kudos
Reply