3939function Base. getindex (bt:: AbstractBlockTuple , bi:: BlockIndexRange{1} )
4040 return bt[Block (bi)][only (bi. indices)]
4141end
42+ # needed for nested broadcast in Julia < 1.11
43+ Base. getindex (bt:: AbstractBlockTuple , ci:: CartesianIndex{1} ) = bt[only (Tuple (ci))]
4244
4345Base. iterate (bt:: AbstractBlockTuple ) = iterate (Tuple (bt))
4446Base. iterate (bt:: AbstractBlockTuple , i:: Int ) = iterate (Tuple (bt), i)
@@ -53,6 +55,14 @@ function Base.map(f, bt::AbstractBlockTuple)
5355 return widened_constructorof (typeof (bt))(map (f, Tuple (bt)), Val (BL))
5456end
5557
58+ function Base. show (io:: IO , bt:: AbstractBlockTuple )
59+ return print (io, nameof (typeof (bt)), blocks (bt))
60+ end
61+ function Base. show (io:: IO , :: MIME"text/plain" , bt:: AbstractBlockTuple )
62+ println (io, typeof (bt))
63+ return print (io, blocks (bt))
64+ end
65+
5666# Broadcast interface
5767Base. broadcastable (bt:: AbstractBlockTuple ) = bt
5868struct AbstractBlockTupleBroadcastStyle{BlockLengths,BT} <: Broadcast.BroadcastStyle end
@@ -72,6 +82,8 @@ function Base.copy(
7282 return widened_constructorof (BT)(bc. f .((Tuple .(bc. args)). .. ), Val (BlockLengths))
7383end
7484
85+ Base. ndims (:: Type{<:AbstractBlockTuple} ) = 1 # needed in nested broadcast
86+
7587# BlockArrays interface
7688BlockArrays. blockfirsts (:: AbstractBlockTuple{0} ) = ()
7789function BlockArrays. blockfirsts (bt:: AbstractBlockTuple )
0 commit comments