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

FFTViews breaks with loaded (PaddedViews | OffsetArrays) #20

Open
roflmaostc opened this issue Mar 22, 2021 · 0 comments · May be fixed by #22
Open

FFTViews breaks with loaded (PaddedViews | OffsetArrays) #20

roflmaostc opened this issue Mar 22, 2021 · 0 comments · May be fixed by #22

Comments

@roflmaostc
Copy link

roflmaostc commented Mar 22, 2021

Hey,

ref PaddedViews breaks FFTViews #50

Similar happens with OffsetArrays:

julia> using FFTViews

julia> x = FFTView(ones((3)))
3-element FFTView{Float64, 1, Vector{Float64}} with indices URange(0,2):
 1.0
 1.0
 1.0

julia> x .+ 1
3-element FFTView{Float64, 1, Vector{Float64}} with indices URange(0,2):
 2.0
 2.0
 2.0

julia> using OffsetArrays

julia> x .+ 1
ERROR: MethodError: similar(::Type{Array{Float64, N} where N}, ::Tuple{Base.IdentityUnitRange{FFTViews.URange{Int64}}}) is ambiguous. Candidates:
  similar(f::Union{Function, Type}, shape::Tuple{Union{Base.IdentityUnitRange{FFTViews.URange{T}}, Base.Slice{FFTViews.URange{T}}, FFTViews.URange{T}} where T, Vararg{Union{Base.IdentityUnitRange{FFTViews.URange{T}}, Base.Slice{FFTViews.URange{T}}, FFTViews.URange{T}} where T, N} where N}) in FFTViews at /home/fxw/.julia/packages/FFTViews/LakRJ/src/FFTViews.jl:72
  similar(::Type{T}, shape::Tuple{Union{Integer, AbstractUnitRange}, Vararg{Union{Integer, AbstractUnitRange}, N} where N}) where T<:AbstractArray in OffsetArrays at /home/fxw/.julia/packages/OffsetArrays/lli7H/src/OffsetArrays.jl:272
Possible fix, define
  similar(::Type{T}, ::Tuple{Union{Base.IdentityUnitRange{FFTViews.URange{T}}, Base.Slice{FFTViews.URange{T}}, FFTViews.URange{T}} where T, Vararg{Union{Base.IdentityUnitRange{FFTViews.URange{T}}, Base.Slice{FFTViews.URange{T}}, FFTViews.URange{T}} where T, N} where N}) where T<:AbstractArray
Stacktrace:
 [1] similar(#unused#::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Tuple{Base.IdentityUnitRange{FFTViews.URange{Int64}}}, typeof(+), Tuple{FFTView{Float64, 1, Vector{Float64}}, Int64}}, #unused#::Type{Float64}, dims::Tuple{Base.IdentityUnitRange{FFTViews.URange{Int64}}})
   @ Base.Broadcast ./broadcast.jl:197
 [2] similar(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Tuple{Base.IdentityUnitRange{FFTViews.URange{Int64}}}, typeof(+), Tuple{FFTView{Float64, 1, Vector{Float64}}, Int64}}, #unused#::Type{Float64})
   @ Base.Broadcast ./broadcast.jl:196
 [3] copy
   @ ./broadcast.jl:908 [inlined]
 [4] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(+), Tuple{FFTView{Float64, 1, Vector{Float64}}, Int64}})
   @ Base.Broadcast ./broadcast.jl:883
 [5] top-level scope
   @ REPL[5]:1

I've seen the comment regarding the composition of several types but that's the issue here, is it?

Thanks a lot!

Felix

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

Successfully merging a pull request may close this issue.

1 participant