I have a 2D array where the axes are positions (x, y). I wish to perform a Fourier transform along the x axis alone resulting in an array (Kx, y), where Kx is momentum, the Fourier transform of x.
In python this is a simple command as you can pass which axis to perform the transform along as an argument to the FFT function.
Is there a way to do this with the MKL library?
Thanks very much,
Do you write C or fortran code? Yes, you can use MKL function to do this operation.. If you have c or fortran develop environment, In MKL install directory/example directory or MKL user manual, you will find some sample code of C and Fortran code about 1D MKL FFT.
//...put input data into x,...,x; y,...,y
status = DftiCreateDescriptor( &my_desc1_handle, DFTI_SINGLE,
DFTI_COMPLEX, 1, 32);
status = DftiCommitDescriptor( my_desc1_handle );
status = DftiComputeForward( my_desc1_handle, x);
status = DftiFreeDescriptor(&my_desc1_handle);
/* result is x, ..., x*/
status = DftiCreateDescriptor( &my_desc2_handle, DFTI_SINGLE,
DFTI_REAL, 1, 32);
status = DftiCommitDescriptor( my_desc2_handle);
status = DftiComputeForward( my_desc2_handle, y);
status = DftiFreeDescriptor(&my_desc2_handle)
Once you can run them, i believe you can figure out how to handle your case. for example, if your input data is not continuous (like c row-major stored), You may define DFTI_INPUT_STRIDES. and for (i=0;i<column;i++); status = DftiComputeForward( my_desc2_handle, &y);
Or anther way, If you are working in Python. you may follow up the article: https://software.intel.com/en-us/articles/using-intel-mkl-in-your-python-programs, then add MKL FFT call in the code.
Intel MKL Support