Recent changes to feature-requestshttp://sourceforge.net/p/jtransforms/feature-requests/Recent changes to feature-requestsenThu, 16 Feb 2012 08:29:37 -0000FFT 2D subset using Fast fractional Fourier transformhttp://sourceforge.net/p/jtransforms/feature-requests/2/<div class="markdown_content"><p>To avoid zero padding and compute correctly a subset of the DFT, there are specific FFT algorithms like the Fast fractional Fourier transform: David H. Bailey and P. N. Swarztrauber, "The fractional Fourier transform and applications," SIAM Review, vol. 33 no. 3 (Sep 1991), pg. 389-404<br />
<a href="http://crd.lbl.gov/~dhbailey/dhbpapers/fracfft.pdf" rel="nofollow">http://crd.lbl.gov/~dhbailey/dhbpapers/fracfft.pdf</a></p>
<p>I read this article and I think it could be worth to implement such algorithms into JTransforms as it already provides FFT related sub routines (bluestein ...). Of course, it requires to implement Fractional FFT 1D that generalizes FFT 1D ...</p>
<p>What is your opinion ?</p>
<p>Could you estimate the implementation cost / difficulty to implement the Fractional FFT algorithm ?</p></div>Laurent BourgèsThu, 16 Feb 2012 08:29:37 -0000http://sourceforge.neta327615f9e0bd6858e6117d56987c7f57d44d195compute only subset of the fourier transform (zero centered)http://sourceforge.net/p/jtransforms/feature-requests/1/<div class="markdown_content"><p>As I only need a subset of the fourier transform (centered on zero), I implemented an optimized realForward alternative: realForwardSubset(final int subSize, float[][]) where subSize corresponds to both input image size and output DFT size.</p>
<p>The main idea consist in avoiding computing frequencies higher than desired subSize and using only the input image << FFT size to use less memory (subSize x DFT size instead of size x size) and skip FFT over zero values i.e. avoid zero padding.</p>
<p>I provide the pacthed FloatFFT_2D class to have your review / point of view. The only problem I guess concerns data in the first column (re/im) that contains values for zero, rows/2 and columns/2 (mixed).</p>
<p>I also added another optimization to avoid allocating too large arrays newRows / newCols for very large FFT (>64K) and work in parallel on chunks in a sort of pipeline (rows => output) > (output => columns) > final subpart. Doing so, it only consumes 512M to compute an FFT 256K for an output size of 8192.</p>
<p>I think such enhancement could be generalized to other FFT methods and at least integrated to the next JTransforms release. What is your opinion ?</p>
<p>Here are benchmark results limited to 16K full FFT due to the memory limit on my computer (2g):<br />
Full FFT:<br />
11:42:42.588 INFO [main] fits.ImageFitsTest - FFT realForward[2048 - 2048]: average duration = 153.7692635 ms (10 iterations).<br />
11:42:50.915 INFO [main] fits.ImageFitsTest - FFT realForward[4096 - 4096]: average duration = 433.6015159 ms (10 iterations).<br />
11:43:13.437 INFO [main] fits.ImageFitsTest - FFT realForward[8192 - 8192]: average duration = 1777.2291536 ms (10 iterations).<br />
11:44:51.746 INFO [main] fits.ImageFitsTest - FFT realForward[16384 - 16384]: average duration = 8456.270368399999 ms (10 iterations).<br />
FFT Subset:<br />
11:42:44.607 INFO [main] fits.ImageFitsTest - FFT realForward[512 - 2048]: average duration = 30.388753700000002 ms (10 iterations). (5 times faster)<br />
11:42:53.209 INFO [main] fits.ImageFitsTest - FFT realForward[512 - 4096]: average duration = 64.2379522 ms (10 iterations). (6.9 times faster)<br />
11:43:16.189 INFO [main] fits.ImageFitsTest - FFT realForward[512 - 8192]: average duration = 111.0820636 ms (10 iterations). (16 times faster)<br />
11:44:56.155 INFO [main] fits.ImageFitsTest - FFT realForward[512 - 16384]: average duration = 261.37946509999995 ms (10 iterations). (32.3 times faster)</p></div>Laurent BourgèsThu, 16 Feb 2012 08:25:38 -0000http://sourceforge.net768fe831ee2059b621e6ad6caad89d7bfa8fda8e