JuliaArrays / FillArrays.jl

Julia package for lazily representing matrices filled with a single entry

Home Page:https://juliaarrays.github.io/FillArrays.jl/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Zeros(5) ./ Zeros(5) gives ambiguity error

dlfivefifty opened this issue · comments

julia> Zeros(5) ./ Zeros(5)
ERROR: MethodError: broadcasted(::Base.Broadcast.DefaultArrayStyle{1}, ::typeof(/), ::Zeros{Float64,1,Tuple{Base.OneTo{Int64}}}, ::Zeros{Float64,1,Tuple{Base.OneTo{Int64}}}) is ambiguous. Candidates:
  broadcasted(::Base.Broadcast.DefaultArrayStyle, ::typeof(/), a::Zeros, b::AbstractArray{var"#s14",N} where N where var"#s14"<:Number) in FillArrays at /Users/sheehanolver/Projects/FillArrays.jl/src/fillbroadcast.jl:56
  broadcasted(::Base.Broadcast.DefaultArrayStyle, op, a::FillArrays.AbstractFill, b::FillArrays.AbstractFill) in FillArrays at /Users/sheehanolver/Projects/FillArrays.jl/src/fillbroadcast.jl:25
Possible fix, define
  broadcasted(::Base.Broadcast.DefaultArrayStyle, ::typeof(/), ::Zeros, ::FillArrays.AbstractFill{T,N,Axes} where Axes where N where T<:Number)
Stacktrace:
 [1] broadcasted(::Function, ::Zeros{Float64,1,Tuple{Base.OneTo{Int64}}}, ::Zeros{Float64,1,Tuple{Base.OneTo{Int64}}}) at ./broadcast.jl:1263
 [2] top-level scope at REPL[53]:1
 [3] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1088

I suppose this should return Fill(NaN, 5)?

Now works:

julia> Zeros(5) ./ Zeros(5)
5-element Fill{Float64}: entries equal to NaN