FFT/HilbertTransform extremely slow on a large 1D wave
alfredzong
I have a 1D single-precision 9811768-long wave (see attached data.ibw). For some reason, executing
HilbertTransform data
in Igor Pro 6.34A takes forever to complete (I waited for 20 minutes and still not finished). I suspected the reason may be related to a slow FFT. Indeed, executing
FFT data
also takes forever to complete.
However, it seems that the problem may not be related to the length of the wave, as the following command takes a second to finish:
Make/N=10000000 test = gnoise(0.5)
HilbertTransform test
I was wondering what causes a rather slow HilbertTransform/FFT operation?
Forum
Support
Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More
To understand the performance of the FFT you may want to execute:
W_PrimeFactors={2,2,2,1226471}
As you can see, the last factor is a large prime. Your best bet is to add a few points to your array so that the prime factor decomposition of the array size consists of small factors. Ideally, you should look for a size that is a power of 2 (so all the prime factors are 2).
For example, if you choose 5*2^21=10485760 the only non 2 factor is 5 and you get an efficient FFT.
I hope this helps,
A.G.
WaveMetrics, Inc.
August 22, 2018 at 05:18 pm - Permalink
In reply to To understand the… by Igor
The answer pinpoints the problem exactly. Thank you!
August 22, 2018 at 05:57 pm - Permalink
If an fft of arrays with large prime number factors is necessary, you might want to look at fftw (http://www.fftw.org/). It is significantly faster than Igor's fft implementation for large prime number factor arrays.
fftw could be integrated into Igor with an XOP.
August 28, 2018 at 12:36 pm - Permalink