在 Julia 中使用 ifft 时出错
Error using ifft with Julia
我尝试使用 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}。
谢谢
这里只是一个猜测: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
我尝试使用 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}。
谢谢
这里只是一个猜测: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