You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This enables nested block indexing by generalizing `BlockIndex` to allow
indices that aren't integers, for example:
```julia
julia> using BlockArrays
julia> a = mortar([[1, 2], [3, 4]])
2-blocked 4-element BlockVector{Int64}:
1
2
─
3
4
julia> b = mortar([[5, 6], [7, 8]])
2-blocked 4-element BlockVector{Int64}:
5
6
─
7
8
julia> A = mortar([a, b])
2-blocked 8-element BlockVector{Int64, Vector{BlockVector{Int64, Vector{Vector{Int64}}, Tuple{BlockedOneTo{Int64, Vector{Int64}}}}}, Tuple{BlockedOneTo{Int64, Vector{Int64}}}}:
1
2
3
4
─
5
6
7
8
julia> A[Block(2)[Block(1)]]
2-element Vector{Int64}:
5
6
```
As an alternative to just generalizing `BlockIndex`, maybe we could
define a new type such as `GenericBlockIndex` and then make `BlockIndex`
a type alias for that with the indices restricted to integers. I don't
have a strong opinion about that but this design was simpler and I don't
see much advantage one way or another.
Related to JuliaArrays#49 and JuliaArrays#446, though note that in this PR the nested block
structure isn't reflected in the axes, which would be required for more
systematic support of nested block structures. This PR is split off from
JuliaArrays#462.
---------
Co-authored-by: Sheehan Olver <[email protected]>
0 commit comments