'Inverse FFT in R mismatches FFTSharp/alglib.net inverse FFT

I am doing a conversion of R to C# and I notice that the inverse FFT from R of a multiplcation result of 2 ffts does not match the result of FFTSharp or either the alglib.net IFFT results. The R implementation is something like

fft(fft1_result * fft2_result,inverse = T)/(n) 

where n = length of multiplication array. (n= 131072 in my case)

The result of the multiplication (fft1_result * fft2_result) from R and C# are same except that the C# results have far more decimal precision points.

The results from the inverse FFT are similar in the Real part but the imaginary part is not correct and also the results at the tail end of the array are slightly off from each other.

While the results from the FFTSharp and alglib.net matches well, still at the tail end of the array there is a slight mismatch.

Please help fix this error. Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source