I have the following code:
Ga=rfft2(A)
A
is type float32
, but Ga
comes out as complex128
effectively doubling my data. How can I get out complex64
data? Certainly this isn't the default functionality for fftw
?
I have the following code:
Ga=rfft2(A)
A
is type float32
, but Ga
comes out as complex128
effectively doubling my data. How can I get out complex64
data? Certainly this isn't the default functionality for fftw
?
Copyright © 2021 Jogjafile Inc.
Well, it seems that the type is defined quite deep in the C code. fftpack_litemodule.c uses
NPY_CDOUBLE
as the array type and that is basically yourcomplex128
. The only solution that I see is to transform the array tocomplex64
usingastype(np.complex64)
or to use the scipy.fftpack package which returns an array offloat64
encoding the complex values as: