1

I have an input complex<double>* g (2D-array).

In order to fourier transform it I first convert it

in=(fftw_complex*)g;

Where in is the input for fftw.

After performing the fft, the code

fftw_free(out);
fftw_free(in); 

doesnt work.

I get an "unhandled exception" error.

I'm afraid the problem is with the conversion. any ideas?

Thanks a lot.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
  • There is a discussion on casting STL complex to and from fftw_complex here: http://stackoverflow.com/q/4214400/1328439. – Dima Chubarov Jan 25 '13 at 12:05
  • I didn't miss it. But they are talking about converting complex and not complex*. – Yair Forchevsky Jan 25 '13 at 12:16
  • BTW, when trying the to work with the solution offered in the link you suggested, The problem remains basically the same. This time I define an array temp of type fftw_complex* and use memcpy to to copy the data to temp, so noe free works on the input and output of the fft (in and out) but fftw_free(temp) gives "unhandled exception" error again... so the problem is just displaced... – Yair Forchevsky Jan 28 '13 at 16:22
  • What happens if you "manually" copy the data from _g_ to _in_? Are you still able to perform the _fftw_free()_ operations? Also, it might be worthwhile sharing the "performing the fft" part of your code. You might be doing something in there that you didn't think would cause trouble. Or you could just try a _fftw_free()_ immediately after recasting to see if its really the re-casting that's causing the problem. – tir38 Apr 29 '13 at 17:49
  • I have tried to reproduce this problem with the *very* limited information in the question but am unable to. The error is most likely in code that is not shown. Its not clear whether `fftw_free(out);` causes the exception or `fftw_free(in);`. If its `fftw_free(out);` then it most likely isn't the conversion that is the issue. How do you allocate `g`? What do you do in between the conversion and freeing of `in`? Do you deallocate `g` after converting it? – IKavanagh Sep 16 '15 at 11:39

0 Answers0