JuliaDSP / FourierTransforms.jl

Fourier transforms written in Julia
MIT License
20 stars 2 forks source link

Indexing confusion #3

Closed Keno closed 5 years ago

Keno commented 5 years ago

The code in here assumes it's passed a canonically-indexed array, but accepts any AbstractArray (and then accesses it out of bounds with @inbounds set).

x = OffsetArray(Complex{FourierTransforms.Float64}[1.0, 2.0], 0:1)
julia> FourierTransforms.plan_fft(x)*x
2-element OffsetArray(::Array{Complex{Float64},1}, 0:1) with eltype Complex{Float64} with indices 0:1:
 2.300566222e-314 + 2.3005662377e-314im
              2.0 + 2.2317219686e-314im

The fft functions in AbstractFFTs do transform the index space, but as shown above the plan interface gives garbage on OffsetArray.