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

Collision of LazyArrays and FillArrays broadcasting #143

Open
mcabbott opened this issue Mar 27, 2021 · 1 comment · May be fixed by #385
Open

Collision of LazyArrays and FillArrays broadcasting #143

mcabbott opened this issue Mar 27, 2021 · 1 comment · May be fixed by #385

Comments

@mcabbott
Copy link
Contributor

This came up here: https://discourse.julialang.org/t/preventing-collect-on-broadcasting-expressions/57996

julia> using LazyArrays, FillArrays

julia> BroadcastArray(+, fill(1,2), 3)
2-element BroadcastVector{Int64, typeof(+), Tuple{Vector{Int64}, Int64}}:
 4
 4

julia> broadcast(+, Fill(1,2), 3)
2-element Fill{Int64, 1, Tuple{Base.OneTo{Int64}}} = 4

julia> BroadcastArray(+, Fill(1,2), 3)
ERROR: type Fill has no field f
Stacktrace:
 [1] getproperty(x::Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, f::Symbol)
   @ Base ./Base.jl:33
 [2] call(#unused#::ArrayLayouts.FillLayout, a::Fill{Int64, 1, Tuple{Base.OneTo{Int64}}})
   @ LazyArrays ~/.julia/packages/LazyArrays/MAEFm/src/lazyapplying.jl:21
 [3] call(a::Fill{Int64, 1, Tuple{Base.OneTo{Int64}}})
   @ LazyArrays ~/.julia/packages/LazyArrays/MAEFm/src/lazyapplying.jl:22
 [4] BroadcastArray(A::Fill{Int64, 1, Tuple{Base.OneTo{Int64}}})
   @ LazyArrays ~/.julia/packages/LazyArrays/MAEFm/src/lazybroadcasting.jl:46
 [5] BroadcastArray(f::Function, A::Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, As::Int64)
   @ LazyArrays ~/.julia/packages/LazyArrays/MAEFm/src/lazybroadcasting.jl:33
 [6] top-level scope
   @ REPL[66]:1
@dlfivefifty
Copy link
Member

This is really a problem in LazyArrays.jl: in

https://github.com/JuliaArrays/LazyArrays.jl/blob/30929f3d8b87ddf8582cfd69e2e67d77082e113a/src/lazybroadcasting.jl#L58

We call broadcasted but forget that it might return something other than a Broadcasted.

@jishnub jishnub linked a pull request Aug 26, 2024 that will close this issue
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.

2 participants