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

ComplexF16 doesn't have a method for plan_fft, plan_bfft

Open dsweber2 opened this issue 5 years ago • 1 comments

trying fft(randn(ComplexF16,10)) gives the error

ERROR: MethodError: no method matching plan_fft(::Array{Complex{Float16},1}, ::UnitRange{Int64})
Closest candidates are:
  plan_fft(::Union{DenseArray{T<:Union{Complex{Float32}, Complex{Float64}},N}, ReinterpretArray{T<:Union{Complex{Float32}, Complex{Float64}},N,S,A} where S where A<:Union{SubArray{T,N,A,I,true} where I<:Union{Tuple{Vararg{Real,N} where N}, Tuple{AbstractUnitRange,Vararg{Any,N} where N}} where A<:DenseArray where N where T, DenseArray}, ReshapedArray{T<:Union{Complex{Float32}, Complex{Float64}},N,A,MI} where MI<:Tuple{Vararg{SignedMultiplicativeInverse{Int64},N} where N} where A<:Union{ReinterpretArray{T,N,S,A} where S where A<:Union{SubArray{T,N,A,I,true} where I<:Union{Tuple{Vararg{Real,N} where N}, Tuple{AbstractUnitRange,Vararg{Any,N} where N}} where A<:DenseArray where N where T, DenseArray} where N where T, SubArray{T,N,A,I,true} where I<:Union{Tuple{Vararg{Real,N} where N}, Tuple{AbstractUnitRange,Vararg{Any,N} where N}} where A<:DenseArray where N where T, DenseArray}, SubArray{T<:Union{Complex{Float32}, Complex{Float64}},N,A,I,L} where L where I<:Tuple{Vararg{Union{Int64, AbstractRange{Int64}, AbstractCartesianIndex},N} where N} where A<:Union{ReinterpretArray{T,N,S,A} where S where A<:Union{SubArray{T,N,A,I,true} where I<:Union{Tuple{Vararg{Real,N} where N}, Tuple{AbstractUnitRange,Vararg{Any,N} where N}} where A<:DenseArray where N where T, DenseArray} where N where T, ReshapedArray{T,N,A,MI} where MI<:Tuple{Vararg{SignedMultiplicativeInverse{Int64},N} where N} where A<:Union{ReinterpretArray{T,N,S,A} where S where A<:Union{SubArray{T,N,A,I,true} where I<:Union{Tuple{Vararg{Real,N} where N}, Tuple{AbstractUnitRange,Vararg{Any,N} where N}} where A<:DenseArray where N where T, DenseArray} where N where T, SubArray{T,N,A,I,true} where I<:Union{Tuple{Vararg{Real,N} where N}, Tuple{AbstractUnitRange,Vararg{Any,N} where N}} where A<:DenseArray where N where T, DenseArray} where N where T, DenseArray}}, ::Any; flags, timelimit) where {T<:Union{Complex{Float32}, Complex{Float64}}, N} at /home/dsweber/.julia/dev/FFTW/src/fft.jl:619
  plan_fft(::AbstractArray{#s16,N} where N where #s16<:Real, ::Any; kws...) at /home/dsweber/.julia/packages/AbstractFFTs/7WCaR/src/definitions.jl:199
  plan_fft(::AbstractArray{#s25,N} where N where #s25<:(Complex{#s26} where #s26<:Union{Integer, Rational}), ::Any; kws...) at /home/dsweber/.julia/packages/AbstractFFTs/7WCaR/src/definitions.jl:201
  ...
Stacktrace:
 [1] #plan_fft#1(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Array{Complex{Float16},1}) at /home/dsweber/.julia/packages/AbstractFFTs/7WCaR/src/definitions.jl:52
 [2] plan_fft(::Array{Complex{Float16},1}) at /home/dsweber/.julia/packages/AbstractFFTs/7WCaR/src/definitions.jl:52
 [3] fft(::Array{Complex{Float16},1}) at /home/dsweber/.julia/packages/AbstractFFTs/7WCaR/src/definitions.jl:50
 [4] top-level scope at none:0

this is somewhat surprising given that a real version fft(randn(Float16,10)) works just fine

dsweber2 avatar Mar 13 '19 21:03 dsweber2

Note that under the hood there is no Float16 algorithm in FFTW. fft(randn(Float16,10)) is just converting to a ComplexF32 array internally, I think.

But it would be nicer if it did the conversion for you in the ComplexF16 case as well.

stevengj avatar Mar 15 '19 13:03 stevengj