When using r2c and c2r FFTW in Fortran, are the forward and backward dimensions same?

后端 未结 2 856
旧巷少年郎
旧巷少年郎 2021-01-27 17:26

Blow is a main file

PROGRAM SPHEROID

USE nrtype
USE SUB_INFO
INCLUDE \"/usr/local/include/fftw3.f\"

INTEGER(I8B) :: plan_forward, plan_backward
INTEGER(I4B) ::         


        
2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-27 18:25

    One issue may be that dfftw_execute_dft_c2r can destroy the content of the input array, as described in this page. The key excerpt is

    FFTW_PRESERVE_INPUT specifies that an out-of-place transform must not change its input array. This is ordinarily the default, except for c2r and hc2r (i.e. complex-to-real) transforms for which FFTW_DESTROY_INPUTis the default...

    We can verify this, for example, by modifying the sample code by @VladimirF such that it saves data_out to data_save right after the first FFT(r2c) call, and then calculating their difference after the second FFT (c2r) call. So, in the case of OP's code, it seems safer to save output1 and output2 to different arrays before entering the second FFT (c2r).

提交回复
热议问题