@@ -8,7 +8,8 @@ CompositionArray{C}(args...; kwargs...) where {C<:AbstractComposition} = Composi
88CompositionArray (d:: Dict ) = CompositionArray (TupleDataset (d))
99CompositionArray {C} (d:: Dict ) where {C<: AbstractComposition } = CompositionArray {C} (TupleDataset (d))
1010# Convert CompositionArrays to other CompositionArrays
11- CompositionArray {C} (a:: CompositionArray ) where {C<: AbstractComposition } = CompositionArray (C .(a))
11+ CompositionArray (a:: CompositionArray ) = a
12+ CompositionArray {C} (a:: CompositionArray ) where {C<: AbstractComposition } = C .(a)
1213export CompositionArray
1314
1415# Type aliases for vectors and matrices
@@ -54,10 +55,10 @@ Base.sizehint!(A::CompositionArray, i::Integer) = sizehint!(getfield(A, :data))
5455Base. copy (A:: CompositionArray ) = CompositionArray (copy (getfield (A, :data )))
5556
5657# # Broadcasting interface (enable this if we want broadcasting on CompositionArrays to return CompositionArrays)
57- # struct CompositionArrayStyle <: Broadcast.BroadcastStyle end
58- # Broadcast.BroadcastStyle(::Type{CompositionArray}) = CompositionArrayStyle()
59- # Broadcast.BroadcastStyle(::CompositionArrayStyle, ::Broadcast.DefaultArrayStyle) = CompositionArrayStyle()
60- # Base.similar(bc::Base.Broadcast.Broadcasted{CompositionArrayStyle}, ::Type{T}) where {T} = similar(CompositionArray{T}, axes(bc))
58+ struct CompositionArrayStyle <: Base. Broadcast.BroadcastStyle end
59+ Base . Broadcast. BroadcastStyle (:: Type{<: CompositionArray} ) = CompositionArrayStyle ()
60+ Base . Broadcast. BroadcastStyle (:: CompositionArrayStyle , :: Base. Broadcast.DefaultArrayStyle ) = CompositionArrayStyle ()
61+ Base. similar (bc:: Base.Broadcast.Broadcasted{CompositionArrayStyle} , :: Type{T} ) where {T} = similar (CompositionArray{T}, axes (bc))
6162
6263# Other Base functions
6364function Base. isapprox (x:: CompositionArray , y:: CompositionArray ; kwargs... )
0 commit comments