69
69
70
70
# # Interlace operator
71
71
72
- struct InterlaceOperator{T,p,DS,RS,DI,RI,BI,BBW} <: Operator{T}
73
- ops:: Array{Operator{T},p}
72
+ struct InterlaceOperator{T,p,DS,RS,DI,RI,BI,BBW,A <: AbstractArray{<:Operator{T},p} } <: Operator{T}
73
+ ops:: A
74
74
domainspace:: DS
75
75
rangespace:: RS
76
76
domaininterlacer:: DI
@@ -79,11 +79,12 @@ struct InterlaceOperator{T,p,DS,RS,DI,RI,BI,BBW} <: Operator{T}
79
79
blockbandwidths:: BBW
80
80
israggedbelow:: Bool
81
81
82
- function InterlaceOperator (ops:: Array{Operator{T},p} , ds:: DS , rs:: RS , dsi:: DI , rsi:: RI , bw:: BI ,
82
+ function InterlaceOperator (ops:: A , ds:: DS , rs:: RS , dsi:: DI , rsi:: RI , bw:: BI ,
83
83
blockbandwidths:: BBW = bandwidthsmax (ops, blockbandwidths),
84
- israggedbelow:: Bool = all (israggedbelow, ops)) where {T,p,DS,RS,DI,RI,BI,BBW}
84
+ israggedbelow:: Bool = all (israggedbelow, ops)
85
+ ) where {T,p,DS,RS,DI,RI,BI,BBW,A<: AbstractArray{<:Operator{T},p} }
85
86
86
- new {T,p,DS,RS,DI,RI,BI,BBW} (ops, ds, rs, dsi, rsi, bw, blockbandwidths, israggedbelow)
87
+ new {T,p,DS,RS,DI,RI,BI,BBW,A } (ops, ds, rs, dsi, rsi, bw, blockbandwidths, israggedbelow)
87
88
end
88
89
end
89
90
@@ -146,8 +147,9 @@ function InterlaceOperator(ops::AbstractMatrix{<:Operator},ds::Space,rs::Space;
146
147
dsi = interlacer (ds)
147
148
rsi = interlacer (rs)
148
149
149
- MT = Matrix{Operator{promote_eltypeof (ops)}}
150
- opsm = strictconvert (MT, ops)
150
+ T = promote_eltypeof (ops)
151
+ opsm = ops isa AbstractMatrix{Operator{T}} ? ops :
152
+ map (x -> strictconvert (Operator{T}, x), ops)
151
153
InterlaceOperator (opsm,ds,rs,
152
154
cache (dsi),
153
155
cache (rsi),
@@ -179,8 +181,10 @@ function InterlaceOperator(ops::VectorOrTupleOfOp, ds::Space, rs::Space;
179
181
blockbandwidths = bandwidthsmax (ops, blockbandwidths),
180
182
israggedbelow = all (israggedbelow, ops))
181
183
182
- VT = Vector{Operator{promote_eltypeof (ops)}}
183
- opsv = strictconvert (VT, convert_vector (ops))
184
+ T = promote_eltypeof (ops)
185
+ opsabsv = convert_vector_or_svector (ops)
186
+ opsv = opsabsv isa AbstractVector{Operator{T}} ? opsabsv :
187
+ map (x -> convert (Operator{T}, x), opsabsv)
184
188
InterlaceOperator (opsv,ds,rs,
185
189
cache (BlockInterlacer (tuple (blocklengths (ds)))),
186
190
cache (interlacer (rs)),
@@ -220,7 +224,7 @@ function convert(::Type{Operator{T}},S::InterlaceOperator) where T
220
224
if T == eltype (S)
221
225
S
222
226
else
223
- ops = convert (AbstractArray{ Operator{T}} , S. ops)
227
+ ops = map (x -> convert (Operator{T},x) , S. ops)
224
228
InterlaceOperator (ops,domainspace (S),rangespace (S),
225
229
S. domaininterlacer,S. rangeinterlacer,S. bandwidths,
226
230
S. blockbandwidths, S. israggedbelow)
0 commit comments