Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Dylan_B_
Beginner
85 Views

Performing DFTI along a single axis of 2D array

Hi there,

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,
Dylan

0 Kudos
2 Replies
Ying_H_Intel
Employee
85 Views

Hi Dylan, 

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.  

float y[34];
DFTI_DESCRIPTOR_HANDLE my_desc1_handle;
DFTI_DESCRIPTOR_HANDLE my_desc2_handle;
MKL_LONG status;
//...put input data into x[0],...,x[31]; y[0],...,y[31]
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[0], ..., x[31]*/
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[0]);

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. 

Best Regards,
Ying

Intel MKL Support 

Dylan_B_
Beginner
85 Views

Hi Ying,

Thanks very much for you help. This solved my question exactly.

Thanks again,

Dylan

Reply