BlockArrays.jl icon indicating copy to clipboard operation
BlockArrays.jl copied to clipboard

Handling zero sized blocks in assignment with broadcast and operation on self

Open krcools opened this issue 11 months ago • 1 comments

This looks like it might be related to #203 , but I am reporting this for completeness. Assignment in combination with broadcasting does not handle zero-sized blocks correctly:

julia> y = BlockedArray([2.0, 3.0], [1,0,1])
3-blocked 2-element BlockedVector{Float64}:
 2.0
 ───
 3.0

julia> z = y .+ 100.0  # correct result
3-blocked 2-element BlockedVector{Float64}:
 102.0
 ─────
 103.0

julia> y .+= 100.0 # second block is not acted upon
3-blocked 2-element BlockedVector{Float64}:
 102.0
 ─────
   3.0

krcools avatar Jan 08 '25 09:01 krcools

Nice catch! A PR to fix this would be greatly appreciated.

dlfivefifty avatar Jan 08 '25 10:01 dlfivefifty