Good morning, I'm trying to perform a 2D FFT
as 2 1-Dimensional FFT
.
The problem setup is the following:
There's a matrix of complex numbers generated by an inverse FFT
on an array of real numbers, lets call it arr[-nx..+nx][-nz..+nz]
.
Now, since the original array was made up of real numbers, I exploit the symmetry and reduce my array to be arr[0..nx][-nz..+nz]
.
My problem starts here, with arr[0..nx][-nz..nz]
provided.
Now I should come back in the domain of real numbers.
The question is what kind of transformation I should use in the 2 directions?
In x
I use the fftw_plan_r2r_1d( .., .., .., FFTW_HC2R, ..)
, called Half complex to Real
transformation because in that direction I've exploited the symmetry, and that's ok I think.
But in z
direction I can't figure out if I should use the same transformation or, the Complex to complex (C2C)
transformation?
What is the correct once and why?
In case of needing here, at page 11, the HC2R transformation is briefly described
Thank you
"To easily retrieve a result comparable to that of
fftw_plan_dft_r2c_2d()
, you can chain a call tofftw_plan_dft_r2c_1d()
and a call to the complex-to-complex dftfftw_plan_many_dft()
. The argumentshowmany
andistride
can easily be tuned to match the pattern of the output offftw_plan_dft_r2c_1d()
. Contrary tofftw_plan_dft_r2c_1d()
, the r2r_1d(...FFTW_HR2C...) separates the real and complex component of each frequency. A secondFFTW_HR2C
can be applied and would be comparable tofftw_plan_dft_r2c_2d()
but not exactly similar.As quoted on the page 11 of the documentation that you judiciously linked,
'Half of these column transforms, however, are of imaginary parts, and should therefore be multiplied by I and combined with the r2hc transforms of the real columns to produce the 2d DFT amplitudes; ... Thus, ... we recommend using the ordinary r2c/c2r interface.'
Since you have an array of complex numbers, you can either use c2r transforms or unfold real/imaginary parts and try to use HC2R transforms. The former option seems the most practical.Which one might solve your issue?"
-@Francis