OK that makes sense. But then why is rfft on a vector length 2*(n-1) more than
2x faster than FFT.REDFT00?
julia> r=rand(100000);@time for k=1:100 FFTW.r2r(r,FFTW.REDFT00) end;
2.496130 seconds (8.30 k allocations: 76.703 MB, 0.76% gc time)
julia> r=rand(2*(100000-1));@time for k=1:100 rfft(r) end;
0.943706 seconds (8.30 k allocations: 152.985 MB, 1.58% gc time)
PS Why doesn't fft(::Vector{Float64}) automatically call rfft and re-interpret
the output?
> On 24 Sep 2015, at 10:59 am, Steven G. Johnson <[email protected]> wrote:
>
>
>
> On Wednesday, September 23, 2015 at 3:47:43 AM UTC-4, Sheehan Olver wrote:
> OK that makes sense. But why is Julia 2x slower than Matlab for some
> values of n (see below, the timing difference is consistent when looped
> over)? Shouldn’t they both be using FFTW?
>
> I think that maybe Matlab defaults to using FFTW's real-data routines when
> the data is real, whereas Julia only uses the real-data routines if you
> request them via rfft etc. (The rfft functions have the advantage of
> requiring half of the storage for the output compared to a complex FFT,
> whereas I think Matlab pads the output back to the full length using the
> mirror symmetries.)