JuliaArrays / JuliaArrays/BlockArrays.jl
Broadcasting regression with adjoints in 0.16.22
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 254
- Forks
- 39
- PR merge metrics
- No merged PRs in 30d
Description
m = mortar([rand(i,j) for i=1:3, j=2:3])
m .- (1:5)'
In 0.16.22-23:
ERROR: BoundsError: attempt to access 1-element Vector{Int64} at index [2]
Stacktrace:
[1] getindex
@ .\array.jl:861 [inlined]
[2] iterate
@ C:\Users\sternlab\.julia\packages\BlockArrays\0XNk5\src\blockbroadcast.jl:128 [inlined]
[3] _zip_iterate_some
@ .\iterators.jl:358 [inlined]
[4] _zip_iterate_some (repeats 2 times)
@ .\iterators.jl:360 [inlined]
[5] _zip_iterate_all
@ .\iterators.jl:350 [inlined]
[6] iterate
@ .\iterators.jl:341 [inlined]
[7] macro expansion
@ C:\Users\sternlab\.julia\packages\BlockArrays\0XNk5\src\blockbroadcast.jl:172 [inlined]
[8] _generic_blockbroadcast_copyto!(dest::BlockMatrix{Float64, Matrix{Matrix{Float64}}, Tuple{BlockedUnitRange{Vector{Int64}}, BlockedUnitRange{Vector{Int64}}}}, bc::Base.Broadcast.Broadcasted{BlockArrays.BlockStyle{2}, Tuple{BlockedUnitRange{Vector{Int64}}, BlockedUnitRange{Vector{Int64}}}, typeof(-), Tuple{BlockMatrix{Float64, Matrix{Matrix{Float64}}, Tuple{BlockedUnitRange{Vector{Int64}}, BlockedUnitRange{Vector{Int64}}}}, LinearAlgebra.Adjoint{Int64, UnitRange{Int64}}}})
@ BlockArrays C:\Users\sternlab\.julia\packages\BlockArrays\0XNk5\src\blockbroadcast.jl:148
[9] copyto!(dest::BlockMatrix{Float64, Matrix{Matrix{Float64}}, Tuple{BlockedUnitRange{Vector{Int64}}, BlockedUnitRange{Vector{Int64}}}}, bc::Base.Broadcast.Broadcasted{BlockArrays.BlockStyle{2}, Tuple{BlockedUnitRange{Vector{Int64}}, BlockedUnitRange{Vector{Int64}}}, typeof(-), Tuple{BlockMatrix{Float64, Matrix{Matrix{Float64}}, Tuple{BlockedUnitRange{Vector{Int64}}, BlockedUnitRange{Vector{Int64}}}}, LinearAlgebra.Adjoint{Int64, UnitRange{Int64}}}})
@ BlockArrays C:\Users\sternlab\.julia\packages\BlockArrays\0XNk5\src\blockbroadcast.jl:190
[10] copy
@ .\broadcast.jl:885 [inlined]
[11] materialize(bc::Base.Broadcast.Broadcasted{BlockArrays.BlockStyle{2}, Nothing, typeof(-), Tuple{BlockMatrix{Float64, Matrix{Matrix{Float64}}, Tuple{BlockedUnitRange{Vector{Int64}}, BlockedUnitRange{Vector{Int64}}}}, LinearAlgebra.Adjoint{Int64, UnitRange{Int64}}}})
@ Base.Broadcast .\broadcast.jl:860
[12] top-level scope
@ Untitled-4:8
This works fine in 0.16.21.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the broadcasting expression from the issue in Julia 0.16.22-23 and compare it with 0.16.21. Start in src/blockbroadcast.jl around the iterate and _generic_blockbroadcast_copyto! locations shown in the stack trace. Done means the adjoint expression no longer raises the BoundsError and retains the behavior seen in 0.16.21.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100