Question

I want to do a ‘complex_to_real’ transformation, it means, the IFFT. I realised that I need to preserve the inputs of the transformation for a later use, so I add to the plan of the ‘dft’ the flag : “PRESERVE_INPUT”.

After adding this flag I become with a problem in compilation time , it goes to ‘dbgmalloc.c’, that means that it should be a allocation memory problem, but I didn’t change anything, and without the new flag it worked properly.

Can you give me some hints?

    // IFFT ( U1,U2 --> u1,u2)
    //----IFFT-----
    double *u1 = (double*) malloc(sizeof(double)*N_fft);
    double *u2 = (double*) malloc(sizeof(double)*N_fft);
    fftw_plan p3;
    fftw_plan p4;

    p3 = fftw_plan_dft_c2r_2d(alto, ancho, U1, u1, FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
    p4 = fftw_plan_dft_c2r_2d(alto, ancho, U2, u2, FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
    fftw_execute(p3); 
    fftw_execute(p4); 
    fftw_destroy_plan(p3);
    fftw_destroy_plan(p4); 

Regards

Antonio

Was it helpful?

Solution

As can be see in this link, it is not supported this flag for multi-dimensional real DFTs

http://www.fftw.org/doc/One_002dDimensional-DFTs-of-Real-Data.html

As noted above, the c2r transform destroys its input array even for out-of-place transforms. This can be prevented, if necessary, by including FFTW_PRESERVE_INPUT in the flags, with unfortunately some sacrifice in performance. This flag is also not currently supported for multi-dimensional real DFTs (next section).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top