I use this code to create a 2D array having a complex data type (from complex.h to c). Then I want to find the fft of this array in place. However, it gives a segmentation error, which, I fear, is due to the casting of the pointer incorrectly. How do we use the complex data type for fftw?
complex float* a=(complex float*)malloc(sizeof(complex float)*NO_INPUTS*blockSize);
fftw_plan p;
p=fftw_plan_dft_2d(blockSize,NO_INPUTS,(fftw_complex*)a,(fftw_complex*)a,FFTW_FORWARD,FFTW_ESTIMATE);
fftw_execute(p);
fftw_destroy_plan(p);
Note that I do not want to use fftw_complex or fftw_malloc. Thank.
Divij source
share