I know the first parameter of “FFT” is the dimensions, and the second one is the length for every dimension. But I do not know how to upload the data, so I use a one dimensional array to save the input data, and use “SavePoints” to upload it. However, the result is wrong, the following picture shows the real part of the FFT result projection.
So I think there is something wrong about the input data uploading, could anybody helps me?
$ root FFT3.C
------------------------------------------------------------------
| Welcome to ROOT 6.27/01 https://root.cern |
| (c) 1995-2022, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for macosx64 on Dec 20 2022, 09:26:19 |
| From heads/master@v6-25-02-3381-geecfc4aff9 |
| With Apple clang version 14.0.0 (clang-1400.0.29.202) |
| Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |
------------------------------------------------------------------
root [0]
Processing FFT3.C...
Error in <TVirtualFFT::FFT>: handler not found
Error in <HandleInterpreterException>: Trying to dereference null pointer or trying to call routine taking non-null arguments
Execution of your code was aborted.
In file included from input_line_9:1:
/Users/couet/Downloads/FFT3.C:82:4: warning: null passed to a callee that requires a non-null argument [-Wnonnull]
fft->SetPoints(A);
^~~
root [1]
The functions TVirtualFFT::SetPoints and TVirtualFFT::GetPoints are for 1d data. For multi-dimensional data you should use the SetPoint and GetPointComplex or GetPointReal functions where you pass an int * for the point coordinates.
Thank you very much, it works. I want to make Inverse Fourier transform with the real part and imaginary part which I got before to check the result. So I use “SetPoint” to upload the data like this:
However, I get the correct result which is the same as the primary data. I don’t know the reason, can you help me please?
This is my new code, Thank you a lot. FFT3.C (4.4 KB)
Thank you for posting your problem. First of all if you are doing a complex to real transform the input data should have the size n1n2(n3/2+1), so in your loop on k you should go not until 128, but only until 65.
This is the reason of getting this error. I attached here the update script. FFT3.C (4.4 KB)
The code should work after the changes. I have verified the code for the implementation and seems to be correct. If you have further issues, please let me know