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 fft? #8

Open
milankl opened this issue Sep 19, 2019 · 1 comment
Open

type-flexible fft? #8

milankl opened this issue Sep 19, 2019 · 1 comment

Comments

@milankl
Copy link

milankl commented Sep 19, 2019

Thanks for the effort towards a pure-Julia fft package. I'm very interested in type-flexible fft, which I thought would be supported with such an fft implementation. However, Float16 is promoted to Float32

julia> x = rand(Float16,4);
julia> FourierTransforms.fft(x)
4-element Array{Complex{Float32},1}:
  2.2734375f0 + 0.0f0im       
 -0.6142578f0 + 0.38378906f0im
 -0.5371094f0 + 0.0f0im       
 -0.6142578f0 - 0.38378906f0im

and arbitrary number formats are not supported

julia> using SoftPosit
julia> x = Posit16.(rand(4))
4-element Array{Posit16,1}:
     Posit16(0x3e4e)
     Posit16(0x0eb6)
     Posit16(0x10d8)    
     Posit16(0x308f)    
julia> FourierTransforms.fft(x)
ERROR: type Posit16 not supported
Stacktrace: ...

Can I contribute somehow to make this package fully type-flexible?

@milankl
Copy link
Author

milankl commented Sep 19, 2019

Hmmm maybe I shouldn't have commented out the stacktrace

 [2] _fftfloat(::Type{Posit16}) at /home/username/.julia/packages/AbstractFFTs/PUqOK/src/definitions.jl:22

so it's about these two lines (20 & 22), which explain the above.

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

could we now change them thanks to FourierTransforms.jl?

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

1 participant