Hi everybody, I have a Fortran90 program where I have to use FFTW librairies. fftw is written in C but wrappers exist for Fortran. Thus ffwt_plan_dft_1d can be applied as in C with slight differences (no ffwt_malloc, no fftw_free, and no pointer). I have an array of 0 everywhere except within the central part (=1), real data that I put into the real components of the complex input "in". The imaginary components of the complex input are all zeros. my input "in" is defined as complex : the real part is equel to my real array, and imaginary part is all 0. this is how I call fftw_plan_dft_1d in Fortran90 : call fftw_plan_dft_1d(plan,N, in, out, FFTW_FORWARD, FFTW_ESTIMATE) plan is defined as integer*8. The operation is doing well when N is not so high (<100). When N = 2000 for example, every component of the output, real and imaginary, is exactly zero !! I would be grateful to anyone who could enlighten me as to why this is the case. Many thanks in advance for any help, Franck
fftw_plan_dft_1d F90
Started by ●May 16, 2006
Reply by ●May 17, 20062006-05-17
bastide wrote:> The operation is doing well when N is not so high (<100). When N = 2000 > for example, every component of the output, real and imaginary, is exactly zero !!Are you sure you're using FFTW_ESTIMATE? If you are using FFTW_MEASURE or FFTW_PATIENT, then you have to initialize your array after creating the plan (see Q3.16 in the FAQ) since the planner sets the data to zero. Cordially, Steven G. Johnson
Reply by ●May 17, 20062006-05-17
Yes, I really use FFTW_ESTIMATE but I initialized the input before creating plan ! It seems that even with FFTW_ESTIMATE, I have to initialize it after creating the plan. It's ok, now. Thanks so much for your answer Steven !! Franck. For people who would have the same problem, this is what you have to do in your code (I spent too much time to undestrand why output was all 0) : call fftw_plan_dft_1d(plan,N, in, out, FFTW_FORWARD, FFTW_ESTIMATE) in=0 ! <------------------ initialize the input here call fftw_execute(plan) call fftw_destroy_plan(plan)
Reply by ●May 18, 20062006-05-18
Something is still wrong, because FFTW_ESTIMATE mode should not overwrite the data. For one thing, you're using the wrong subroutine name...the name of the Fortran wrapper is dfftw_plan_dft_1d, not fftw_plan_dft_1d. Steven
Reply by ●May 22, 20062006-05-22
Yes, you're right. I use dfftw_ instaed of fftw as written above. Sorry for this mistake. For FFTW_ESTIMATE, I agree with you again. It seems that I have to initialize my array only if I use FFTW_MEASURE or FFTW_PATIENT. However, if I don't initialize this input array with the use od FFTW_ESTIMATE, there are still 0 in output ! (I don't understand why). Thanks again Franck
Reply by ●May 22, 20062006-05-22
Yes, you're right. I use dfftw_ instaed of fftw as written above. Sorry for this mistake. For FFTW_ESTIMATE, I agree with you again. It seems that I have to initialize my array only if I use FFTW_MEASURE or FFTW_PATIENT. However, if I don't initialize this input array with the use od FFTW_ESTIMATE, there are still 0 in output ! (I don't understand why). Thanks again Franck
Reply by ●May 22, 20062006-05-22