@@ -87,11 +87,7 @@ const VectorInterlaceOperator = InterlaceOperator{T,1,DS,RS} where {T,DS,RS<:Spa
87
87
const MatrixInterlaceOperator = InterlaceOperator{T,2 ,DS,RS} where {T,DS,RS<: Space{D,R} } where {D,R<: AbstractVector }
88
88
89
89
90
- InterlaceOperator (ops:: Array{T,p} ,ds,rs,di,ri,bi) where {T,p} =
91
- InterlaceOperator{T,p,typeof (ds),typeof (rs),
92
- typeof (di),typeof (ri),typeof (bi)}(ops,ds,rs,di,ri,bi)
93
-
94
- function InterlaceOperator (ops:: AbstractMatrix{Operator{T}} ,ds:: Space ,rs:: Space ) where T
90
+ function InterlaceOperator (ops:: AbstractMatrix{<:Operator} ,ds:: Space ,rs:: Space )
95
91
# calculate bandwidths TODO : generalize
96
92
p= size (ops,1 )
97
93
dsi = interlacer (ds)
@@ -122,7 +118,7 @@ function InterlaceOperator(ops::AbstractMatrix{Operator{T}},ds::Space,rs::Space)
122
118
end
123
119
124
120
125
- function InterlaceOperator (ops:: Vector{Operator{T}} ,ds:: Space ,rs:: Space ) where T
121
+ function InterlaceOperator (ops:: Vector{<: Operator} ,ds:: Space ,rs:: Space )
126
122
# calculate bandwidths
127
123
p= size (ops,1 )
128
124
if all (isbanded,ops)
@@ -145,27 +141,27 @@ function InterlaceOperator(ops::Vector{Operator{T}},ds::Space,rs::Space) where T
145
141
(l,u))
146
142
end
147
143
148
- function InterlaceOperator (opsin:: AbstractMatrix{Operator{T}} ) where {T}
144
+ function InterlaceOperator (opsin:: AbstractMatrix{<: Operator} )
149
145
isempty (opsin) && throw (ArgumentError (" Cannot create InterlaceOperator from empty Matrix" ))
150
146
ops= promotespaces (opsin)
151
147
InterlaceOperator (ops,domainspace (ops),rangespace (ops[:,1 ]))
152
148
end
153
149
154
- function InterlaceOperator (opsin:: AbstractMatrix{Operator{T}} ,:: Type{DS} ,:: Type{RS} ) where {T, DS<: Space ,RS<: Space }
150
+ function InterlaceOperator (opsin:: AbstractMatrix{<: Operator} ,:: Type{DS} ,:: Type{RS} ) where {DS<: Space ,RS<: Space }
155
151
isempty (opsin) && throw (ArgumentError (" Cannot create InterlaceOperator from empty Matrix" ))
156
152
ops= promotespaces (opsin)
157
153
InterlaceOperator (ops,DS (components (domainspace (ops))),RS (rangespace (ops[:,1 ]). spaces))
158
154
end
159
155
160
156
161
- function InterlaceOperator (opsin:: RowVector{Operator{T}} ) where {T}
157
+ function InterlaceOperator (opsin:: RowVector{<: Operator} )
162
158
isempty (opsin) && throw (ArgumentError (" Cannot create InterlaceOperator from empty Matrix" ))
163
159
164
160
ops= promotespaces (opsin)
165
161
InterlaceOperator (ops,domainspace (ops),rangespace (ops[1 ]))
166
162
end
167
163
168
- function InterlaceOperator (opsin:: RowVector{Operator{T}} ,:: Type{DS} ,:: Type{RS} ) where {T, DS<: Space ,RS<: Space }
164
+ function InterlaceOperator (opsin:: RowVector{<: Operator} ,:: Type{DS} ,:: Type{RS} ) where {DS<: Space ,RS<: Space }
169
165
isempty (opsin) && throw (ArgumentError (" Cannot create InterlaceOperator from empty Matrix" ))
170
166
ops= promotespaces (opsin)
171
167
InterlaceOperator (ops,DS (components (domainspace (ops))),rangespace (ops[1 ]))
@@ -174,13 +170,13 @@ end
174
170
175
171
176
172
177
- InterlaceOperator (opsin:: AbstractMatrix{Operator{T}} ,:: Type{DS} ) where {T, DS<: Space } =
173
+ InterlaceOperator (opsin:: AbstractMatrix{<: Operator} ,:: Type{DS} ) where {DS<: Space } =
178
174
InterlaceOperator (opsin,DS,DS)
179
175
180
176
InterlaceOperator (opsin:: AbstractMatrix ,S... ) =
181
177
InterlaceOperator (Matrix {Operator{mapreduce(eltype,promote_type,opsin)}} (promotespaces (opsin)),S... )
182
178
183
- function InterlaceOperator (opsin:: Vector{Operator{T}} ) where T
179
+ function InterlaceOperator (opsin:: Union{ Vector{<: Operator}, Tuple{Operator, Vararg{Operator}}} )
184
180
ops= promotedomainspace (opsin)
185
181
InterlaceOperator (ops,domainspace (first (ops)),rangespace (ops))
186
182
end
@@ -193,10 +189,7 @@ function convert(::Type{Operator{T}},S::InterlaceOperator) where T
193
189
if T == eltype (S)
194
190
S
195
191
else
196
- ops= Array {Operator{T}} (undef, size (S. ops)... )
197
- for j= 1 : size (S. ops,2 ),k= 1 : size (S. ops,1 )
198
- ops[k,j]= S. ops[k,j]
199
- end
192
+ ops = convert (AbstractArray{Operator{T}}, S. ops)
200
193
InterlaceOperator (ops,domainspace (S),rangespace (S),
201
194
S. domaininterlacer,S. rangeinterlacer,S. bandwidths)
202
195
end
223
216
224
217
225
218
226
- function colstop (M:: InterlaceOperator{T} , j:: Integer ) where T
219
+ function colstop (M:: InterlaceOperator , j:: Integer )
227
220
# b=bandwidth(M,1)
228
221
if isbandedbelow (M)
229
222
min (j+ bandwidth (M,1 ):: Int ,size (M,1 )):: Int
@@ -260,7 +253,7 @@ function getindex(op::InterlaceOperator{T,1},k::Integer,j::Integer) where T
260
253
op. ops[N][K,j]:: T
261
254
end
262
255
263
- function getindex (op:: InterlaceOperator{T} , k:: Integer ) where T
256
+ function getindex (op:: InterlaceOperator , k:: Integer )
264
257
if size (op,1 ) == 1
265
258
op[1 ,k]
266
259
elseif size (op,2 ) == 1
@@ -439,7 +432,7 @@ promotedomainspace(A::InterlaceOperator{T,1},sp::Space) where {T} =
439
432
InterlaceOperator (map (op-> promotedomainspace (op,sp),A. ops))
440
433
441
434
442
- interlace (A:: AbstractArray{T} ) where {T <: Operator } = InterlaceOperator (A)
435
+ interlace (A:: AbstractArray{<:Operator} ) = InterlaceOperator (A)
443
436
444
437
const OperatorTypes = Union{Operator,Fun,Number,UniformScaling}
445
438
@@ -495,7 +488,7 @@ Base.hvcat(rows::Tuple{Vararg{Int}}, D::Union{Fun,Number,UniformScaling}, C::Uni
495
488
496
489
# # Convert Matrix operator to operators
497
490
498
- Operator (M:: AbstractArray{OO} ) where {OO <: Operator } = InterlaceOperator (M)
491
+ Operator (M:: AbstractArray{<:Operator} ) = InterlaceOperator (M)
499
492
500
493
501
494
0 commit comments