Skip to content

Commit e99b03f

Browse files
committed
_BroadcastStyle
1 parent 01f7178 commit e99b03f

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/lazyapplying.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,9 @@ function show(io::IO, A::Applied)
333333
print(io, ')')
334334
end
335335

336+
_BroadcastStyle(x...) = BroadcastStyle(x...)
337+
_BroadcastStyle(::Type{<:AbstractQ}) = DefaultArrayStyle{2}()
338+
336339
applybroadcaststyle(::Type{<:AbstractArray{<:Any,N}}, _2) where N = DefaultArrayStyle{N}()
337340
applybroadcaststyle(::Type{<:AbstractArray{<:Any,N}}, ::AbstractLazyLayout) where N = LazyArrayStyle{N}()
338341
applybroadcaststyle(::Type{<:ApplyArray{<:Any,N,<:Any,Args}}, ::AbstractLazyLayout) where {N,Args<:Tuple} = result_style(LazyArrayStyle{N}(), tuple_type_broadcastlayout(Args))

src/lazyconcat.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -439,13 +439,13 @@ end
439439
# to take advantage of special implementations of the sub-components
440440
######
441441

442-
@inline tuple_type_broadcastlayout(::Type{I}) where {I<:Tuple} = result_style(BroadcastStyle(Base.tuple_type_head(I)), tuple_type_broadcastlayout(Base.tuple_type_tail(I)))
442+
@inline tuple_type_broadcastlayout(::Type{I}) where {I<:Tuple} = result_style(_BroadcastStyle(Base.tuple_type_head(I)), tuple_type_broadcastlayout(Base.tuple_type_tail(I)))
443443
@inline tuple_type_broadcastlayout(::Type{Tuple{}}) = Unknown()
444-
@inline tuple_type_broadcastlayout(::Type{Tuple{A}}) where {A} = BroadcastStyle(A)
445-
@inline tuple_type_broadcastlayout(::Type{Tuple{A,B}}) where {A,B} = result_style(BroadcastStyle(A), BroadcastStyle(B))
446-
@inline tuple_type_broadcastlayout(::Type{Tuple{A,B,C}}) where {A,B,C} = result_style(BroadcastStyle(A), tuple_type_broadcastlayout(Tuple{B,C}))
447-
@inline tuple_type_broadcastlayout(::Type{Tuple{A,B,C,D}}) where {A,B,C,D} = result_style(BroadcastStyle(A), tuple_type_broadcastlayout(Tuple{B,C,D}))
448-
@inline tuple_type_broadcastlayout(::Type{Tuple{A,B,C,D,E}}) where {A,B,C,D,E} = result_style(BroadcastStyle(A), tuple_type_broadcastlayout(Tuple{B,C,D,E}))
444+
@inline tuple_type_broadcastlayout(::Type{Tuple{A}}) where {A} = _BroadcastStyle(A)
445+
@inline tuple_type_broadcastlayout(::Type{Tuple{A,B}}) where {A,B} = result_style(_BroadcastStyle(A), _BroadcastStyle(B))
446+
@inline tuple_type_broadcastlayout(::Type{Tuple{A,B,C}}) where {A,B,C} = result_style(_BroadcastStyle(A), tuple_type_broadcastlayout(Tuple{B,C}))
447+
@inline tuple_type_broadcastlayout(::Type{Tuple{A,B,C,D}}) where {A,B,C,D} = result_style(_BroadcastStyle(A), tuple_type_broadcastlayout(Tuple{B,C,D}))
448+
@inline tuple_type_broadcastlayout(::Type{Tuple{A,B,C,D,E}}) where {A,B,C,D,E} = result_style(_BroadcastStyle(A), tuple_type_broadcastlayout(Tuple{B,C,D,E}))
449449

450450
BroadcastStyle(::Type{<:Vcat{<:Any,N,I}}) where {N,I<:Tuple} = result_style(LazyArrayStyle{N}(), tuple_type_broadcastlayout(I)) # the <:Tuple is to avoid ambiguity
451451
BroadcastStyle(::Type{<:Hcat{<:Any,I}}) where {I<:Tuple} = result_style(LazyArrayStyle{2}(), tuple_type_broadcastlayout(I))

0 commit comments

Comments
 (0)