MP-Gadget / pfft-python

python binding of pfft
GNU General Public License v3.0
15 stars 9 forks source link

Segmentation fault when R2R transform #8

Closed simonlegrand closed 2 months ago

simonlegrand commented 5 years ago

Hello,

I just tried to adapt example/example.py into a 2R2 transform but I get a segmentation fault a the Plan object creation. It doesn't happen with other types of transforms. Digging a little bit, the fault seems to occur line 869 of core.pyx: cdef pfft_plan_func func = PFFT_PLAN_FUNC[self.type] I remarked too there were no Type.R2R : Type.R2R in the dictionary 'inverse' of the method 'inverse' of class Type but I don't know if those are related.

Have you experienced such behavior?

Best regards and thank you for this great wrapper!

Simon

rainwoodman commented 5 years ago

I am not very familiar with R2R transforms, and the support to it in the binding is thus not finished.

I'll really appreciate if you can help me to finish this part of the binding.

rainwoodman commented 5 years ago

I added a PR that fixes the segfault, but I am not sure if this will cover your use case. Could take a look at it at #9?

simonlegrand commented 5 years ago

Thanks a lot, it works and it covers my first use cases. I just started working with R2R, not really familiar with it yet neither. I'll let you know if I have working test cases.

rainwoodman commented 5 years ago

The last paragraph here is a bit relevant.

http://www.fftw.org/fftw3_doc/The-Halfcomplex_002dformat-DFT.html#The-Halfcomplex_002dformat-DFT

I think what was written there is saying using all R2HC transforms in > 1 dimensions does not make proper Fourier transforms; so you'll have to be very careful about what you do in this special 'spectral space'.