Hi All,

I just begin to try to use MKL for my 2D FFT computation. But I am not able to figure it out with the provided sample code. My code is very simple (as following). Loading data from a file, then I have a 8x8 2D matrix.But the result is not the same as the outcome of Matlab.

Can someone give me some help why my code is incorrect?

Thanks

int main(int args, char *argv[])

{

int m = 8+2, n = 8+2; //8 by 8 matrix

float *input = (float *)malloc(sizeof(float) * m * n); // 10 = (8/2+1)*2

int i = 0, j = 0;

DFTI_DESCRIPTOR *my_desc1_handle;

double data = 0.0;

long status;

long l[2];

l[0] = 8; l[1] = 8;

//Load data

FILE *stream_input;

if( (stream_input = fopen( "C:\temp\im_cp_MKL_part_fft.txt", "r" )) == NULL ) //data file

return -1;

memset(input, 0, sizeof(float) * m * n); //reset the memory to be all zeros.

//obtain the input data

for(i = 0; i < (m-2)*(n-2); i++)

{

fscanf(stream_input,"%lf", &data);

input[i] = data;

}

fclose(stream_input);

status = DftiCreateDescriptor( &my_desc1_handle, DFTI_SINGLE,DFTI_REAL, 2, l);

status = DftiCommitDescriptor( my_desc1_handle);

status = DftiComputeForward( my_desc1_handle, input);

status = DftiFreeDescriptor(&my_desc1_handle);

free(input);

return 0;

}