JuliaArrays / JuliaArrays/BlockArrays.jl
Err multiplying block array with `Diagonal`
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 254
- Forks
- 39
- PR merge metrics
- No merged PRs in 30d
Description
mortar(reshape([randn(2,2)], 1, 1))*I(2) fails while mortar(reshape([randn(2,2)], 1, 1))*Matrix(I(2)) does not
julia> mortar(reshape([randn(2,2)], 1, 1))*I(2)
ERROR: BoundsError: attempt to access 1-element Base.OneTo{Int64} at index [1:2]
Stacktrace:
[1] throw_boundserror(A::Base.OneTo{Int64}, I::Tuple{UnitRange{Int64}})
@ Base ./abstractarray.jl:734
[2] checkbounds
@ ./abstractarray.jl:699 [inlined]
[3] getindex
@ ./range.jl:988 [inlined]
[4] getindex
@ ~/.julia/packages/BlockArrays/L5yjb/src/blockaxis.jl:10 [inlined]
[5] unblock
@ ~/.julia/packages/BlockArrays/L5yjb/src/views.jl:10 [inlined]
[6] to_indices
@ ~/.julia/packages/BlockArrays/L5yjb/src/views.jl:29 [inlined]
[7] to_indices
@ ~/.julia/packages/BlockArrays/L5yjb/src/views.jl:44 [inlined]
[8] view
@ ./subarray.jl:178 [inlined]
[9] _bview
@ ~/.julia/packages/BlockArrays/L5yjb/src/blockbroadcast.jl:141 [inlined]
[10] macro expansion
@ ~/.julia/packages/BlockArrays/L5yjb/src/blockbroadcast.jl:171 [inlined]
[11] _generic_blockbroadcast_copyto!(dest::BlockMatrix{…}, bc::Base.Broadcast.Broadcasted{…})
@ BlockArrays ~/.julia/packages/BlockArrays/L5yjb/src/blockbroadcast.jl:147
[12] copyto!
@ BlockArrays ~/.julia/packages/BlockArrays/L5yjb/src/blockbroadcast.jl:188 [inlined]
[13] copy(bc::Base.Broadcast.Broadcasted{BlockArrays.BlockStyle{…}, Tuple{…}, typeof(*), Tuple{…}})
@ Base.Broadcast ./broadcast.jl:928
[14] materialize
@ ./broadcast.jl:903 [inlined]
[15] copy(M::ArrayLayouts.Rmul{BlockArrays.BlockLayout{…}, ArrayLayouts.DiagonalLayout{…}, BlockMatrix{…}, Diagonal{…}})
@ ArrayLayouts ~/.julia/packages/ArrayLayouts/824cB/src/diagonal.jl:20
[16] copy
@ ~/.julia/packages/ArrayLayouts/824cB/src/mul.jl:130 [inlined]
[17] materialize
@ ~/.julia/packages/ArrayLayouts/824cB/src/mul.jl:127 [inlined]
[18] mul
@ ~/.julia/packages/ArrayLayouts/824cB/src/mul.jl:128 [inlined]
[19] *(A::BlockMatrix{Float64, Matrix{…}, Tuple{…}}, B::Diagonal{Bool, Vector{…}})
@ ArrayLayouts ~/.julia/packages/ArrayLayouts/824cB/src/mul.jl:252
[20] top-level scope
@ REPL[120]:1
Some type information was truncated. Use `show(err)` to see complete types.
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 failure with mortar(reshape([randn(2,2)], 1, 1))*I(2) and compare it with Matrix(I(2)). Start with BlockArrays/src/blockbroadcast.jl and the unblock path in views.jl, then inspect the ArrayLayouts diagonal multiplication path shown in the stack trace. Done means the Diagonal multiplication no longer raises the reported BoundsError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100