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

error with views of Block and BlockIndex #442

Open
ogauthe opened this issue Dec 9, 2024 · 0 comments
Open

error with views of Block and BlockIndex #442

ogauthe opened this issue Dec 9, 2024 · 0 comments

Comments

@ogauthe
Copy link
Contributor

ogauthe commented Dec 9, 2024

Hi! I noticed some combinations of view fails:

using BlockArrays: BlockArray, Block
ba = BlockArray(ones((1,1)), [1], [1])
julia> view(ba, Block(1,1)[1,1])
ERROR: BoundsError: attempt to access Tuple{} at index [1]
Stacktrace:
 [1] getindex(t::Tuple, i::Int64)
   @ Base ./tuple.jl:31
 [2] to_indices (repeats 2 times)
   @ ~/.julia/packages/BlockArrays/X84bj/src/views.jl:27 [inlined]
 [3] to_indices
   @ ~/.julia/packages/BlockArrays/X84bj/src/views.jl:36 [inlined]
 [4] to_indices
   @ ./indices.jl:360 [inlined]
 [5] view(A::BlockMatrix{Float64, Matrix{…}, Tuple{…}}, I::BlockIndex{2, Tuple{…}, Tuple{…}})
   @ Base ./subarray.jl:213
 [6] top-level scope
   @ REPL[3]:1
Some type information was truncated. Use `show(err)` to see complete types.
julia> @view ba[Block(1,1)[1,1]]
ERROR: BoundsError: attempt to access Tuple{} at index [1]
Stacktrace:
 [1] getindex(t::Tuple, i::Int64)
   @ Base ./tuple.jl:31
 [2] to_indices (repeats 2 times)
   @ ~/.julia/packages/BlockArrays/X84bj/src/views.jl:27 [inlined]
 [3] to_indices
   @ ~/.julia/packages/BlockArrays/X84bj/src/views.jl:36 [inlined]
 [4] to_indices
   @ ./indices.jl:360 [inlined]
 [5] view(A::BlockMatrix{Float64, Matrix{…}, Tuple{…}}, I::BlockIndex{2, Tuple{…}, Tuple{…}})
   @ Base ./subarray.jl:213
 [6] top-level scope
   @ REPL[69]:1
Some type information was truncated. Use `show(err)` to see complete types.

Tested with Julia v"1.11.2" and BlockArrays v1.2.0.

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

No branches or pull requests

1 participant