Skip to content

Commit 291ffd7

Browse files
committed
Removed dead code from old broadcasting stuff
1 parent 2e6acf1 commit 291ffd7

File tree

4 files changed

+1
-56
lines changed

4 files changed

+1
-56
lines changed

src/axis.jl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,6 @@ reindex(ax::ViewAxis, offset) = ViewAxis(viewindex(ax) .+ offset, indexmap(ax))
156156
@inline Base.getindex(::AbstractAxis{IdxMap}, s::Symbol) where IdxMap =
157157
ComponentIndex(getproperty(IdxMap, s))
158158

159-
Base.iterate(ax::AbstractAxis, state=1) = state > lastindex(ax) ? nothing : (ax[state], state+1)
160-
161-
Base.length(ax::AbstractAxis) = lastindex(ax) - firstindex(ax) + 1
162-
163-
Base.UnitRange(ax::AbstractAxis) = firstindex(ax):lastindex(ax)
164-
Base.UnitRange{T}(ax::AbstractAxis) where {T} = T(firstindex(ax)):T(lastindex(ax))
165-
166159

167160
struct CombinedAxis{C,A} <: AbstractUnitRange{Int}
168161
component_axis::C

src/broadcasting.jl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ Base.promote_shape(a::NTuple{N,AbstractUnitRange}, b::Tuple{Vararg{CombinedAxis}
1818
Base.promote_shape(a::Tuple{Vararg{CombinedAxis}}, b::Tuple{Vararg{CombinedAxis}}) = Base.promote_shape(_array_axis.(a), _array_axis.(b))
1919
Base.promote_shape(a::T, b::T) where {T<:Tuple{Vararg{CombinedAxis}}} = a
2020

21-
# Need a special case here because `map` doesn't follow same rules as normal broadcasting. To be safe and avoid ambiguities,
22-
# we'll just handle the case where everything is a ComponentArray. Else it falls back to a plain Array output.
23-
function Base.map(f, xs::ComponentArray{<:Any, <:Any, <:Any, Axes}...) where Axes
24-
return ComponentArray(map(f, getdata.(xs)...), getaxes(Axes))
25-
end
26-
27-
2821
# From https://github.com/JuliaArrays/OffsetArrays.jl/blob/master/src/OffsetArrays.jl
2922
Base.dataids(A::ComponentArray) = Base.dataids(parent(A))
3023
Broadcast.broadcast_unalias(dest::ComponentArray, src) = getdata(dest) === getdata(src) ? src : Broadcast.unalias(dest, src)

src/componentindex.jl

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,9 @@ ComponentIndex(idx::Int) = ComponentIndex(idx, NullAxis())
66
ComponentIndex(idx::Union{FlatIdx, Colon}) = ComponentIndex(idx, FlatAxis())
77
ComponentIndex(vax::ViewAxis{Inds,IdxMap,Ax}) where {Inds,IdxMap,Ax} = ComponentIndex(Inds, vax.ax)
88

9-
value(idx::ComponentIndex) = idx.idx
10-
value(idx) = idx
11-
129
const FlatComponentIndex{Idx} = ComponentIndex{Idx, FlatAxis}
1310
const NullComponentIndex{Idx} = ComponentIndex{Idx, NullAxis}
1411

15-
function Base.getindex(A::AbstractArray, ind::ComponentIndex, inds::ComponentIndex...)
16-
inds = (ind, inds...)
17-
return ComponentArray(A[(i.idx for i in inds)...], Tuple(i.ax for i in inds))
18-
end
19-
Base.getindex(A::ComponentArray, ind::ComponentIndex, inds::ComponentIndex...) = getindex(A, ind.idx, (i.idx for i in inds)...)
20-
Base.getindex(bc::Base.Broadcast.Broadcasted{Nothing}, idx::ComponentIndex) = bc[CartesianIndex(idx)]
21-
22-
# Do we still need this?
23-
Base.getindex(ax::AbstractAxis, ind::ComponentIndex) = ax[ind.idx]
24-
25-
Base.CartesianIndex(idx::Union{ComponentIndex, Integer, CartesianIndex}...) = CartesianIndex(value.(idx)...)
26-
2712

2813
"""
2914
KeepIndex(idx)

src/similar_convert_copy.jl

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -80,30 +80,4 @@ Base.NamedTuple(x::ComponentVector) = _namedtuple(x)
8080

8181

8282
## AbstractAxis conversion and promotion
83-
Base.convert(::Type{Ax}, ax::AbstractAxis) where {Ax<:AbstractAxis} = ax #Ax()
84-
# Base.convert(::Type{Axis}, ax::AbstractAxis) = ax #Ax()
85-
Base.convert(::Type{Ax}, ax::AbstractAxis) where {Ax<:VarAxes} = convert.(typeof.(getaxes(Ax)), (ax,))
86-
87-
Base.promote_rule(AA::Type{<:Axis}, ::Type{NullAxis}) = AA
88-
Base.promote_rule(AA::Type{<:Axis}, ::Type{FlatAxis}) = AA
89-
Base.promote_rule(FA::Type{FlatAxis}, ::Type{NullAxis}) = FA
90-
Base.promote_rule(FA::Type{FlatAxis}, ::Type{FlatAxis}) = FA
91-
Base.promote_rule(NA::Type{NullAxis}, ::Type{NullAxis}) = NA
92-
function Base.promote_rule(A1::Type{<:VarAxes}, A2::Type{<:VarAxes})
93-
# promote_type.(typeof.(getaxes(A1)), typeof.(getaxes(A2)))
94-
ax = typeof(first.(promote.(getaxes(A1), getaxes(A2))))
95-
end
96-
97-
broadcast_promote_type(::Type{FlatAxis}, ax2::Type{<:Axis}) = ax2
98-
broadcast_promote_type(ax1::Type{<:Axis}, ::Type{FlatAxis}) = ax1
99-
broadcast_promote_type(ax1::Type{FlatAxis}, ::Type{NullAxis}) = ax1
100-
broadcast_promote_type(::Type{NullAxis}, ax2::Type{FlatAxis}) = ax2
101-
broadcast_promote_type(::Type{<:Axis}, ::Type{<:Axis}) = FlatAxis
102-
broadcast_promote_type(ax1::Type{Ax}, ::Type{Ax}) where {Ax<:Axis} = ax1
103-
function broadcast_promote_type(A1::Type{<:VarAxes}, A2::Type{<:VarAxes})
104-
ax = Tuple{broadcast_promote_typeof.(getaxes(A1), getaxes(A2))...}
105-
end
106-
107-
broadcast_promote_typeof(ax1, ax2) = broadcast_promote_type(typeof(ax1), typeof(ax2))
108-
109-
broadcast_promote(ax1, ax2) = broadcast_promote_typeof(ax1, ax2)()
83+
Base.convert(::Type{Ax}, ax::AbstractAxis) where {Ax<:AbstractAxis} = ax

0 commit comments

Comments
 (0)