@@ -223,19 +223,23 @@ axpy!(α, S::SubOperator{T,OP}, A::AbstractMatrix) where {T,OP<:ConstantTimesOpe
223223
224224
225225
226- struct TimesOperator{T,BW,SZ,O<: Operator{T} ,BBW,SBBW} <: Operator{T}
226+ struct TimesOperator{T,BW,SZ,O<: Operator{T} ,BBW,SBBW,D } <: Operator{T}
227227 ops:: Vector{O}
228228 bandwidths:: BW
229229 sz:: SZ
230230 blockbandwidths:: BBW
231231 subblockbandwidths:: SBBW
232232 isbandedblockbanded:: Bool
233233 israggedbelow:: Bool
234+ domainspace:: D
234235
235236 function TimesOperator {T,BW,SZ,O,BBW,SBBW} (ops:: Vector{O} , bw:: BW ,
236237 sz:: SZ , bbw:: BBW , sbbw:: SBBW ,
237- ibbb:: Bool , irb:: Bool ) where {T,O<: Operator{T} ,BW,SZ,BBW,SBBW}
238- # check compatible
238+ ibbb:: Bool , irb:: Bool , dsp:: D ) where {T,O<: Operator{T} ,BW,SZ,BBW,SBBW,D}
239+
240+ dsp == domainspace (ops[end ]) || throw (ArgumentError (" incompatible domainspace" ))
241+
242+ # check compatibility
239243 for k = 1 : length (ops)- 1
240244 size (ops[k], 2 ) == size (ops[k+ 1 ], 1 ) || throw (ArgumentError (" incompatible operator sizes" ))
241245 spacescompatible (domainspace (ops[k]), rangespace (ops[k+ 1 ])) || throw (ArgumentError (" incompatible spaces at index $k " ))
@@ -252,7 +256,7 @@ struct TimesOperator{T,BW,SZ,O<:Operator{T},BBW,SBBW} <: Operator{T}
252256 newops = ops
253257 end
254258
255- new {T,BW,SZ,O,BBW,SBBW} (newops, bw, sz, bbw, sbbw, ibbb, irb)
259+ new {T,BW,SZ,O,BBW,SBBW,D } (newops, bw, sz, bbw, sbbw, ibbb, irb, dsp )
256260 end
257261end
258262
@@ -273,9 +277,10 @@ function TimesOperator(ops::AbstractVector{O},
273277 sbbw:: Tuple{Any,Any} = bandwidthssum (ops, subblockbandwidths),
274278 ibbb:: Bool = all (isbandedblockbanded, ops),
275279 irb:: Bool = all (israggedbelow, ops),
280+ dsp = domainspace (last (ops)),
276281 ) where {O<: Operator }
277282 TimesOperator {eltype(O),typeof(bw),typeof(sz),O,typeof(bbw),typeof(sbbw)} (
278- convert_vector (ops), bw, sz, bbw, sbbw, ibbb, irb)
283+ convert_vector (ops), bw, sz, bbw, sbbw, ibbb, irb, dsp )
279284end
280285
281286_extractops (A:: TimesOperator , :: typeof (* )) = A. ops
@@ -284,9 +289,10 @@ function TimesOperator(A::Operator, B::Operator)
284289 v = collateops (* , A, B)
285290 ibbb = all (isbandedblockbanded, (A, B))
286291 irb = all (israggedbelow, (A, B))
292+ dsp = domainspace (B)
287293 TimesOperator (convert_vector (v), _bandwidthssum (A, B), _timessize ((A, B)),
288294 _bandwidthssum (A, B, blockbandwidths),
289- _bandwidthssum (A, B, subblockbandwidths), ibbb, irb)
295+ _bandwidthssum (A, B, subblockbandwidths), ibbb, irb, dsp )
290296end
291297
292298
@@ -301,7 +307,7 @@ function convert(::Type{Operator{T}}, P::TimesOperator) where {T}
301307 _convertops (Operator{T}, ops),
302308 bandwidths (P), size (P), blockbandwidths (P),
303309 subblockbandwidths (P), isbandedblockbanded (P),
304- israggedbelow (P)):: Operator{T}
310+ israggedbelow (P), domainspace (P) ):: Operator{T}
305311 end
306312end
307313
318324 @assert length (opsin) > 1 " need at least 2 operators"
319325 ops, bw, bbw, sbbw, ibbb, irb = __promotetimes (opsin, dsp, anytimesop)
320326 sz = _timessize (ops)
321- TimesOperator (convert_vector (ops), bw, sz, bbw, sbbw, ibbb, irb)
327+ TimesOperator (convert_vector (ops), bw, sz, bbw, sbbw, ibbb, irb, dsp )
322328end
323329function __promotetimes (opsin, dsp, anytimesop)
324330 ops = Vector {Operator{promote_eltypeof(opsin)}} (undef, 0 )
372378 end
373379end
374380
375- domainspace (P:: PlusOrTimesOp ) = domainspace (last (P. ops))
381+ domainspace (P:: PlusOperator ) = domainspace (last (P. ops))
382+ domainspace (T:: TimesOperator ) = T. domainspace
376383rangespace (P:: PlusOrTimesOp ) = rangespace (first (P. ops))
377384
378385domain (P:: TimesOperator ) = commondomain (P. ops)
0 commit comments