[phobos] FFT

David Simcha dsimcha at gmail.com
Sun Aug 1 11:52:54 PDT 2010


So I've changed my mind about the design of my kernel density estimation 
lib that needed an FFT.  I now no longer have an immediate use for an 
FFT in D.  I also gave up on trying to translate kiss_fft because the 
code is so difficult to follow that if it doesn't work I'll be at a loss 
to debug it.

However, in the process of prototyping I wrote a very basic FFT lib.  It 
only handles power of two sizes.  It handles generic random-access 
ranges of complex inputs using std.complex, or pure real inputs of any 
builtin numeric type.  It does not include any cache optimizations and 
takes about 1.7 seconds to do a double[] -> Complex!double FFT of size 
2^20 on my machine Athlon 64 X2 5200+.  (I haven't benchmarked other 
libs so I have no idea how fast or slow this really is).  Support for 
inverse FFTs can be trivially added, and definitely will be if this is 
contributed to Phobos.

As I am no longer going to use FFTs in my kernel density lib, improving 
this FFT code will be bumped down my hacking to-do list.  Does what I 
have now sound better than nothing by a large enough margin to warrant 
inclusion in std.numeric, or does it sound too primitive to be widely 
useful?  If it sounds worth including I'll clean up/document the code 
and send it to the mailing list for review.  If it sounds too primitive, 
I'll just scrap it.


More information about the phobos mailing list