Skip to content

Commit ddbd322

Browse files
committed
allow nested broadcast
1 parent b876749 commit ddbd322

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/blockedtuple.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ function Base.copy(
7272
return widened_constructorof(BT)(bc.f.((Tuple.(bc.args))...), Val(BlockLengths))
7373
end
7474

75+
Base.ndims(::Type{<:AbstractBlockTuple}) = 1 # needed in nested broadcast
76+
7577
# BlockArrays interface
7678
BlockArrays.blockfirsts(::AbstractBlockTuple{0}) = ()
7779
function BlockArrays.blockfirsts(bt::AbstractBlockTuple)

test/test_blockedtuple.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ using TensorAlgebra: BlockedTuple, blockeachindex, tuplemortar
5858

5959
bt = tuplemortar(((1:2, 1:2), (1:3,)))
6060
@test length.(bt) == tuplemortar(((2, 2), (3,)))
61+
@test length.(length.(bt)) == tuplemortar(((1, 1), (1,)))
6162

6263
# empty blocks
6364
bt = tuplemortar(((1,), (), (5, 3)))

0 commit comments

Comments
 (0)