我尝试使用ifft
和Julia计算系数数组的逆傅里叶变换。
我在数组上有N个复数,组织为:Y=[Y_0,.., Y_(N-1)]
表示我的傅里叶系数并通过计算
ifft(Y)
我收到以下错误消息:
MethodError: no method matching plan_bfft(::Array{Complex,1}, ::UnitRange{Int64}) Closest candidates are: plan_bfft{T<:Union{Complex{Float32},Complex{Float64}},N}(::Union{Base.ReshapedArray{T<:Union{Complex{Float32},Complex{Float64}},N,A<:DenseArray,MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N}}},DenseArray{T<:Union{Complex{Float32},Complex{Float64}},N},SubArray{T<:Union{Complex{Float32},Complex{Float64}},N,A<:Union{Base.ReshapedArray{T,N,A<:DenseArray,MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N}}},DenseArray},I<:Tuple{Vararg{Union{Base.AbstractCartesianIndex,Colon,Int64,Range{Int64}},N}},L}}, ::Any; flags, timelimit) at fft/FFTW.jl:601 plan_bfft{T<:Real}(::AbstractArray{T<:Real,N}, ::Any; kws...) at dft.jl:205 plan_bfft{T<:Union{Integer,Rational{T<:Integer}}}(::AbstractArray{Complex{T<:Union{Integer,Rational}},N}, ::Any; kws...) at dft.jl:207 ... in #plan_ifft#15(::Array{Any,1}, ::Function, ::Array{Complex,1}, ::UnitRange{Int64}) at ./dft.jl:268 in #plan_ifft#3(::Array{Any,1}, ::Function, ::Array{Complex,1}) at ./dft.jl:58 in ifft(::Array{Complex,1}) at ./dft.jl:56
有人可以帮忙吗?
当我问typeof(Y)
答案是Array {Complex,1}时。
谢谢
答案 0 :(得分:0)
这里只是猜测:ifft
期望数组元素的类型为Complex{Float64}
,而不是Complex
。此外,
julia> Complex<:Complex{Float64}
false
你是如何获得Complex
数组的?
使用Complex{Float64}
时,一切正常:
julia> Y=complex([1.,2.,3.],[4.,3.,2.])
3-element Array{Complex{Float64},1}:
1.0+4.0im
2.0+3.0im
3.0+2.0im
julia> ifft(Y)
3-element Array{Complex{Float64},1}:
2.0+3.0im
-0.788675+0.211325im
-0.211325+0.788675im