简体   繁体   中英

Efficient plan r2c 1d in FFTW

I read, that FFTW plans take a few seconds, so it's better to call it once, and in the for loop call execute() . This is my case. But of course, in every loop, the input data are different, but the size is the same, So how can I improve it? Is it better solved with boolean variables or not?

fftw_plan my_plan;

in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*N);
v = (double*) fftw_malloc(sizeof(double)*N);
out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*N);


my_plan =fftw_plan_dft_r2c_1d(N,v,out,FFTW_ESTIMATE);
fftw_execute(my_plan);


fftw_destroy_plan(my_plan);

Also, this r2c of dft is only forward?

You can either re-use the same buffers for each FFT (often you need to copy data to/from the in/out buffers and perhaps convert between integer and floating point anyway) or you can use one of the "many" FFTW plans from the advanced interface , using eg fftw_plan_many_dft() .

For an inverse FFT you probably want a C2R plan using either of the above methods and use the FFTW_BACKWARD flag when creating the plan.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM