AbstractFFTs.jl icon indicating copy to clipboard operation
AbstractFFTs.jl copied to clipboard

type-flexible FFTs?

Open milankl opened this issue 6 years ago • 9 comments

I've raised this issue https://github.com/JuliaComputing/FourierTransforms.jl/issues/8#issue-495818536, which is about https://github.com/JuliaMath/AbstractFFTs.jl/blob/66695a72b2a29a059a9bf5fae51a3107172f146d/src/definitions.jl#L20-L22

In theory, FourierTransforms.jl should allow for a type-flexible FFT, i.e. fft(::Array{T,1}) where {T<:AbstractFloat}, but currently it doesn't. Would it be possible to change these lines thanks to the pure-Julia FourierTransforms.jl, which is not limited to Float32/Float64 (as for example FFTW is)?

milankl avatar Sep 24 '19 09:09 milankl

Have you checked out https://github.com/JuliaApproximation/FastTransforms.jl? It has methods for FFT with arbitrary Julia types

giordano avatar Sep 24 '19 09:09 giordano

Seems reasonable to make this more generic; it looks like a legacy of the days when FFTW was the only FFT.

stevengj avatar Sep 24 '19 11:09 stevengj

@stevengj what was your experience like with FastTransforms.jl? I also need flexible types #35

gszep avatar Oct 13 '19 14:10 gszep

@milankl did you find a solution? I also need flexible types #35

gszep avatar Oct 13 '19 14:10 gszep

I haven't looked into it further. I assume that if you use FourierTransforms.jl, line 20 and 22 could simply be commented, but @stevengj should know better.

milankl avatar Oct 13 '19 15:10 milankl

I've almost finished extending the AbstractFFTs methods for Array{TrackedReal} here https://github.com/gszep/FluxContinuation/blob/master/TrackedFFTs.jl could someone give me a pointer on how to extend plan_brfft? the TestPlan in runtests.jl was very helpful but there is no example for plan_brfft

gszep avatar Oct 19 '19 17:10 gszep

@milankl I'm looking for an example (or examples) where FFT, IFFT is evaluated with Posits in particular with Poist16 (SoftPosit.jl)? It would be great if you can point me towards one

tkgunaratne avatar May 06 '22 23:05 tkgunaratne

Technically this should work

julia> using SoftPosit, FastTransforms

julia> x = Posit16.(rand(8))
8-element Vector{Posit16}:
 Posit16(0.6254883)
 Posit16(0.7780762)
 Posit16(0.8145752)
 Posit16(0.50598145)
 Posit16(0.74768066)
 Posit16(0.29797363)
 Posit16(0.89624023)
 Posit16(0.6437988)

julia> fft(x)
ERROR: MethodError: no method matching maxintfloat(::Type{Posit16})

But it doesn't because I haven't implemented the necessary methods in SoftPosit.jl, so we should move this into an issue therein: https://github.com/milankl/SoftPosit.jl/issues/64

milankl avatar May 07 '22 13:05 milankl

@milankl Great! Looking forward for the upgrade!

tkgunaratne avatar May 07 '22 15:05 tkgunaratne