Showing results for 
Search instead for 
Did you mean: 

MKL FFT functions - compute the N-point fft?


Is there a way to compute the n-point fft of an 1D array in MKL (C-language, Linux) for an arbitrary number of n?
The problem is that i need to translate the matlab function fft(X,N) to use with the MKL-lib. The function inside matlab is described as : "fft(X,N) is the N-point fft, padded with zeros if X has less
than N points and truncated if it has more." (see ref.)

As an example, lets say i have a:
Input vector, I_vec, with size of 100 (can vary from 1 to 1500) elements and a output vector, O_vec, with size of 2048 (can vary between the fifth closest power of 2 of input vec).
I want to compute the values on these 100 elements to "fill up" the 2048 (1D) vector.
Let's say that i have computed the values  by the DftiComputeForward. I am then expecting the output to be:
inplace fft for I_vec: I_vec[0] = 0.1, i_vec[1] = 0.2, ....
out of place fft for I_vec to O_vec: O_vec[0] = 0.1 ... O_vec[~10] = 0.15 ... O_vec[~20] = 0.2. 

Is this possible? I have tried to read the reference document and looked at the examples - but cant find anything that does this kind of computation straight away. Maybe do a number of transformations and try to pad inside the vector?  If you have any tips to where to look or can give an example of how to do this, it would be highly appreciated.

Thanks in advance,

More info of the n-point fft can be found on: and the matlab api:

Ubuntu 20.04 (linux)
Intel oneAPI integrated in Eclipse IDE (v. 2021.2.0)
Intel C++ compiler
Intel MKL - static lib
Intel core i7-8750h

0 Kudos
0 Replies