Custom array with padding through a view

It should! Although to really capitalize on it, you’d want a custom FFT function too which is optimized for memory efficiency.

With all the brainiacs here, I don’t doubt that someday we’ll have a full-Julia FFT package. It could get really fun.

I wrote a toy FFT in fourteen lines (ten excluding comments) as a demo for a syntax proposal here and did some rough benchmarking. IIRC, on initial runs it was about 20% slower than FFTW with absolutely zero optimization, no compiler hints, no nothing. Not bad!

But then, on subsequent runs FFTW runs like ten times faster :sweat_smile: it turns out that most of the time is spent computing the twiddle factors (values of e^{-i\theta} where 0\le \theta<\pi). For a given dimensionality of data, the twiddle factors are constant so FFTW will memoize the values to allow later runs to be faster.

I was just toying with syntax, so I couldn’t be bothered to optimize it. Also, FFTW works with non-radix-2 data and multi-dimensional arrays… humanity has spent a fair bit of time developing the package so it’s darn near perfect.

But who knows! Maybe someday somebody will be motivated to port it to Julia (maybe to get automatic differentiation or something?), and then the real fun can begin.