|
1 | | -const BC = Base.Broadcast |
2 | | - |
3 | | -Base.BroadcastStyle(::Type{<:ComponentArray{T, N, A, Axes}}) where {T, N, A, Axes} = BC.BroadcastStyle(A) |
4 | | - |
5 | | -Base.getindex(bc::BC.Broadcasted, inds::ComponentIndex...) = bc[value.(inds)...] |
| 1 | +Base.BroadcastStyle(::Type{<:ComponentArray{T, N, A, Axes}}) where {T, N, A, Axes} = Broadcast.BroadcastStyle(A) |
6 | 2 |
|
7 | 3 | # Need special case here for adjoint vectors in order to avoid type instability in axistype |
8 | | -BC.combine_axes(a::ComponentArray, b::AdjOrTransComponentVector) = (axes(a)[1], axes(b)[2]) |
9 | | -BC.combine_axes(a::AdjOrTransComponentVector, b::ComponentArray) = (axes(b)[2], axes(a)[1]) |
| 4 | +Broadcast.combine_axes(a::ComponentArray, b::AdjOrTransComponentVector) = (axes(a)[1], axes(b)[2]) |
| 5 | +Broadcast.combine_axes(a::AdjOrTransComponentVector, b::ComponentArray) = (axes(b)[2], axes(a)[1]) |
10 | 6 |
|
11 | | -BC.axistype(a::CombinedAxis, b::AbstractUnitRange) = a |
12 | | -BC.axistype(a::AbstractUnitRange, b::CombinedAxis) = b |
13 | | -BC.axistype(a::CombinedAxis, b::CombinedAxis) = CombinedAxis(FlatAxis(), Base.Broadcast.axistype(_array_axis(a), _array_axis(b))) |
14 | | -BC.axistype(a::T, b::T) where {T<:CombinedAxis} = a |
| 7 | +Broadcast.axistype(a::CombinedAxis, b::AbstractUnitRange) = a |
| 8 | +Broadcast.axistype(a::AbstractUnitRange, b::CombinedAxis) = b |
| 9 | +Broadcast.axistype(a::CombinedAxis, b::CombinedAxis) = CombinedAxis(FlatAxis(), Base.Broadcast.axistype(_array_axis(a), _array_axis(b))) |
| 10 | +Broadcast.axistype(a::T, b::T) where {T<:CombinedAxis} = a |
15 | 11 |
|
16 | | -Base.promote_shape(a::Tuple{Vararg{CombinedAxis}}, b::NTuple{N,AbstractUnitRange}) where N = Base.promote_shape(_array_axis.(a), b) |
17 | | -Base.promote_shape(a::NTuple{N,AbstractUnitRange}, b::Tuple{Vararg{CombinedAxis}}) where N = Base.promote_shape(a, _array_axis.(b)) |
| 12 | +Base.promote_shape(a::Tuple{Vararg{CombinedAxis}}, b::NTuple{N,AbstractUnitRange}) where {N} = Base.promote_shape(_array_axis.(a), b) |
| 13 | +Base.promote_shape(a::NTuple{N,AbstractUnitRange}, b::Tuple{Vararg{CombinedAxis}}) where {N} = Base.promote_shape(a, _array_axis.(b)) |
18 | 14 | Base.promote_shape(a::Tuple{Vararg{CombinedAxis}}, b::Tuple{Vararg{CombinedAxis}}) = Base.promote_shape(_array_axis.(a), _array_axis.(b)) |
19 | 15 | Base.promote_shape(a::T, b::T) where {T<:Tuple{Vararg{CombinedAxis}}} = a |
20 | 16 |
|
|
0 commit comments