Skip to content

Commit 6eb9e64

Browse files
authored
union of types in interlaceoperator (#296)
1 parent 7ef0317 commit 6eb9e64

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Operators/general/InterlaceOperator.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ InterlaceOperator(opsin::AbstractMatrix,S...) =
179179
InterlaceOperator(Matrix{Operator{promote_eltypeof(opsin)}}(promotespaces(opsin)),S...)
180180

181181
_convert_vector_or_svector(v::AbstractVector) = convert_vector(v)
182+
_uniontypes_svector(t) = SVector{length(t), mapfoldl(typeof, (x,y)->Union{x,y}, t)}(t)
183+
_convert_vector_or_svector(t::NTuple{2,Any}) = _uniontypes_svector(t)
184+
_convert_vector_or_svector(t::NTuple{3,Any}) = _uniontypes_svector(t)
185+
_convert_vector_or_svector(t::NTuple{4,Any}) = _uniontypes_svector(t)
182186
_convert_vector_or_svector(t::Tuple) = SVector{length(t), mapreduce(typeof, typejoin, t)}(t)
183187

184188
function InterlaceOperator(opsin::AbstractVector{<:Operator})

0 commit comments

Comments
 (0)