Skip to content

Commit

Permalink
Update SumSpace promotion
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos committed Nov 9, 2023
1 parent 5478905 commit 22c341f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/sumspace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,21 @@ function join(S::SumSpace)
end

Base.promote_rule(::Type{S}, ::Type{SumSpace{S}}) where {S} = SumSpace{S}
function Base.promote_rule(::Type{S1}, ::Type{<:ProductSpace{S2}}) where {S1<:ElementarySpace,S2<:ElementarySpace}
return ProductSpace{promote_type(S1,S2)}
end
function Base.promote_rule(::Type{<:ProductSpace{S1}},
::Type{<:ProductSpace{S2}}) where {S1<:ElementarySpace,
S2<:ElementarySpace}
return ProductSpace{promote_type(S1,S2)}
end

Base.convert(::Type{I}, S::SumSpace{I}) where {I} = join(S)
Base.convert(::Type{SumSpace{S}}, V::S) where {S} = SumSpace(V)
function Base.convert(::Type{<:ProductSumSpace{S,N}}, V::ProductSpace{S,N}) where {S,N}
return ProductSumSpace{S,N}(SumSpace.(V.spaces)...)
end
function Base.convert(::Type{ProductSumSpace}, V::ProductSpace{S,N}) where {S,N}
function Base.convert(::Type{<:ProductSumSpace{S}}, V::ProductSpace{S,N}) where {S,N}
return ProductSumSpace{S,N}(SumSpace.(V.spaces)...)
end
function Base.convert(::Type{<:ProductSpace{S,N}}, V::ProductSumSpace{S,N}) where {S,N}
Expand Down

0 comments on commit 22c341f

Please sign in to comment.