I just want to convert my code from matlab to fortran. So I used the mkl-fftw3 library to complete the FFT computation. But during my test, the position of mkl-fftw3 results does not align with matlab results, it might seems like it's the reverse of matlab results.
Is there anyway to transform the fortran results to align with the matlab results?
Btw，I used vs2017 with ivf2019
In fortran I just wrote
double complex t_in(5),t_out(5) integer*8 plan t_in = dcmplx([1:5]) call dfftw_plan_dft_1d(plan,5,t_in,t_out,FFTW_FORWARD,FFTW_EST 1 IMATE) call dfftw_execute_dft(plan, t_in, t_out) call dfftw_destroy_plan(plan) PRINT *,t_out
I also calculated the backward with t_out as the input
(15.0000000000000,0.000000000000000E+000) (-2.50000000000000,-3.44095480117793) (-2.50000000000000,-0.812299240582266) (-2.50000000000000,0.812299240582266) (-2.50000000000000,3.44095480117793) (5,0) (25,0) (20,0) (15,0) (10,0)
15.0000 + 0.0000i -2.5000 + 3.4410i -2.5000 + 0.8123i -2.5000 - 0.8123i -2.5000 - 3.4410i
you may take a look at the existing mkl's examples show how to call fftw3 API from intel MKL. As an example, check, dfftw_plan_dft_1d.f90 from mklroot/examples/fftw3xf/source directory