Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type-flexible FFTs? #34

Open
milankl opened this issue Sep 24, 2019 · 9 comments
Open

type-flexible FFTs? #34

milankl opened this issue Sep 24, 2019 · 9 comments

Comments

@milankl
Copy link
Member

milankl commented Sep 24, 2019

I've raised this issue JuliaDSP/FourierTransforms.jl#8 (comment), which is about

_fftfloat(::Type{Float16}) = Float32
_fftfloat(::Type{Complex{T}}) where {T} = Complex{_fftfloat(T)}
_fftfloat(::Type{T}) where {T} = error("type $T not supported")

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)?

@giordano
Copy link
Member

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

@stevengj
Copy link
Member

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

@gszep
Copy link

gszep commented Oct 13, 2019

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

@gszep
Copy link

gszep commented Oct 13, 2019

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

@milankl
Copy link
Member Author

milankl commented Oct 13, 2019

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.

@gszep
Copy link

gszep commented Oct 19, 2019

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

@tkgunaratne
Copy link

@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

@milankl
Copy link
Member Author

milankl commented May 7, 2022

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: milankl/SoftPosit.jl#64

@tkgunaratne
Copy link

@milankl Great! Looking forward for the upgrade!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants