JuliaArrays / JuliaArrays/BlockArrays.jl
BUG: `BlockVector * Adjoint{BlockVector}` crashes
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 254
- Forks
- 39
- PR merge metrics
- No merged PRs in 30d
Description
using BlockArrays: BlockArray, blockedrange
d = blockedrange([2,3])
v = ones(d)
v2 = BlockArray(v)
v3 = Array(v)
v * v' isa BlockedArray # true
v3 * v3' isa Array # true
v2 * v2' isa Any # BoundsError
ERROR: BoundsError: attempt to access 2-blocked 5-element BlockVector{Float64} at index [BlockSlice(Block(1)[1:2],1:2), BlockSlice(Block(1)[1:2],Base.OneTo(2))]
Stacktrace:
[1] throw_boundserror(A::BlockVector{Float64, Vector{…}, Tuple{…}}, I::Tuple{BlockArrays.BlockSlice{…}, BlockArrays.BlockSlice{…}})
@ Base ./essentials.jl:14
[2] checkbounds
@ ./abstractarray.jl:699 [inlined]
[3] view
@ ./subarray.jl:214 [inlined]
[4] _bview
@ ~/.julia/packages/BlockArrays/tOOU0/src/blockbroadcast.jl:124 [inlined]
[5] (::BlockArrays.var"#56#61"{Base.Broadcast.Broadcasted{…}, Tuple{…}})(i::Int64)
@ BlockArrays ~/.julia/packages/BlockArrays/tOOU0/src/blockbroadcast.jl:156
[6] ntuple
@ ./ntuple.jl:19 [inlined]
[7] _generic_blockbroadcast_copyto!(dest::BlockMatrix{…}, bc::Base.Broadcast.Broadcasted{…})
@ BlockArrays ~/.julia/packages/BlockArrays/tOOU0/src/blockbroadcast.jl:156
[8] copyto!(dest::BlockMatrix{…}, bc::Base.Broadcast.Broadcasted{…})
@ BlockArrays ~/.julia/packages/BlockArrays/tOOU0/src/blockbroadcast.jl:163
[9] copy
@ ./broadcast.jl:897 [inlined]
[10] materialize
@ ./broadcast.jl:872 [inlined]
[11] broadcast(::typeof(*), ::BlockVector{Float64, Vector{…}, Tuple{…}}, ::LinearAlgebra.Adjoint{Float64, BlockVector{…}})
@ Base.Broadcast ./broadcast.jl:810
[12] *(u::BlockVector{Float64, Vector{…}, Tuple{…}}, v::LinearAlgebra.Adjoint{Float64, BlockVector{…}})
@ LinearAlgebra ~/.julia/juliaup/julia-1.11.3+0.x64.linux.gnu/share/julia/stdlib/v1.11/LinearAlgebra/src/adjtrans.jl:484
[13] top-level scope
@ REPL[55]:1
Some type information was truncated. Use `show(err)` to see complete types.
BlockArrays v1.4.0
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 supplied example with Julia and inspect BlockArrays/src/blockbroadcast.jl around _bview and _generic_blockbroadcast_copyto!, then follow the LinearAlgebra adjtrans.jl entry at line 484. Done means v2 * v2' no longer raises BoundsError and behaves consistently with the shown BlockedArray result.
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