Complex to real IFFT using MKL

690 views Asked by At

I am trying to do a 1D IFFT transformation of a complex input array with a conjugate even symmetry, with z(1) and z(N/2+1) being real. The total size of the array is N=256. If I prepare the IFFT like the following:

stat = DftiCreateDescriptor( desc_handle, DFTI_DOUBLE, DFTI_REAL, 1,256)
stat = DftiSetValue(desc_handle, DFTI_CONJUGATE_EVEN_STORAGE, DFTI_COMPLEX_COMPLEX)

stat = DftiSetValue(desc_handle, DFTI_PLACEMENT, DFTI_NOT_INPLACE)

stat = DftiComputeBackward(desc_handle, X_in, M_out)

... where X_in has the conjugate symmetry even described above. That means that M_out is expected to be a mathematical real array in the sense that if:

real(dp) :: M_out(N+2)

then the expected real fortran array with have every other element equal to zero.

complex(dp) :: M_out(N/2)

then the expected complex fortran array will have N/2 size with the imaginary part being zero.

However the results I get are not real after doing the above. It is like the routines do not understand that the input complex fortran array does not have the conjugate even symmetry. Why is that? Do I have to add any other preference parameters to ensure the structure of the input is read correctly?

1

There are 1 answers

0
Pawel Kowal On

In this example forward domain is real and backward domain is conjugate even with complex storage. Therefore MKL expects that X_in is of type Complex[] and M_out is of type Real[]. Results are real.

I suspect, that you supplied a complex array as M_out. Then this array is interpreted as Real[] and contains real results of the backward transform. No zeroes for imaginary part are inserted.