I'm still pretty new to Python, so forgive me this question if it's stupid. I could not find an answer through Google...
I am using PyFFTW in my code, which has a planning stage, where you pass it the two variables (source/destination), that your transforming from/to. It will then, when you call the FFT operate on the exact memory space, where those variables were located during the planning stage. Thus any operations done on the variables will need to be done, so that the location in memory of these two variables do not change.
I found the operators *=, +=, etc., which do this for standard mathematical operators.
However in my program I need to apply a function to the variable, which should return it to the same memory location.
How to do this?!
I initially used slicing in the following way:
a[:] = func(a)[:]
However I just realized, that this is extremely slow (my code is about 10% slower). So does anybody know how to go about this?
Any help is very appreciated. Thanks in advance!