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

a[Block()[]] when iszero(ndims(a)) returns a block, not an element #430

Closed
mtfishman opened this issue Nov 8, 2024 · 1 comment · Fixed by #431
Closed

a[Block()[]] when iszero(ndims(a)) returns a block, not an element #430

mtfishman opened this issue Nov 8, 2024 · 1 comment · Fixed by #431

Comments

@mtfishman
Copy link
Collaborator

mtfishman commented Nov 8, 2024

For example:

julia> using BlockArrays

julia> a = BlockArray{Float64}(undef)
-blocked 0-dimensional BlockArray{Float64, 0}:
1.04e-322

julia> a[] = 2
2

julia> a
-blocked 0-dimensional BlockArray{Float64, 0}:
2.0

julia> a[Block()]
0-dimensional Array{Float64, 0}:
2.0

julia> a[Block()][]
2.0

julia> a[Block()[]]
0-dimensional Array{Float64, 0}:
2.0

julia> pkgversion(BlockArrays)
v"1.1.1"
@mtfishman
Copy link
Collaborator Author

I see, the issue stems from:

julia> Block()[]
Block()

julia> Block()[CartesianIndex()]
Block()

which is defined here: https://github.com/JuliaArrays/BlockArrays.jl/blob/v1.1.1/src/blockindices.jl#L205 and here: https://github.com/JuliaArrays/BlockArrays.jl/blob/v1.1.1/src/blockindices.jl#L59. I assume that should output BlockIndex() (which isn't defined yet, but could be defined as BlockIndex{0,Tuple{},Tuple{}}((), ())).

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

Successfully merging a pull request may close this issue.

1 participant