@@ -240,7 +240,7 @@ function splice_times(ops)
240240 newops
241241end
242242
243- struct TimesOperator{T,BW,SZ,O<: Operator{T} ,BBW,SBBW} <: Operator{T}
243+ struct TimesOperator{T,BW,SZ,O<: Operator{T} ,BBW,SBBW,D } <: Operator{T}
244244 ops:: Vector{O}
245245 bandwidths:: BW
246246 sz:: SZ
@@ -249,19 +249,21 @@ struct TimesOperator{T,BW,SZ,O<:Operator{T},BBW,SBBW} <: Operator{T}
249249 isbandedblockbanded:: Bool
250250 israggedbelow:: Bool
251251 isafunctional:: Bool
252+ domainspace:: D
252253
253254 Base. @constprop :aggressive function TimesOperator {T,BW,SZ,O,BBW,SBBW} (ops:: Vector{O} , bw:: BW ,
254255 sz:: SZ , bbw:: BBW , sbbw:: SBBW ,
255- ibbb:: Bool , irb:: Bool , isaf:: Bool ;
256- anytimesop = any (x -> x isa TimesOperator, ops)) where {T,O<: Operator{T} ,BW,SZ,BBW,SBBW}
256+ ibbb:: Bool , irb:: Bool , isaf:: Bool , dsp :: D ;
257+ anytimesop = any (x -> x isa TimesOperator, ops)) where {T,O<: Operator{T} ,BW,SZ,BBW,SBBW,D }
257258
259+ dsp == domainspace (ops[end ]) || throw (ArgumentError (" incompatible domainspace" ))
258260 # check compatible
259261 check_times (ops)
260262
261263 # remove TimesOperators buried inside ops
262264 newops = anytimesop ? splice_times (ops) : ops
263265
264- new {T,BW,SZ,O,BBW,SBBW} (newops, bw, sz, bbw, sbbw, ibbb, irb, isaf)
266+ new {T,BW,SZ,O,BBW,SBBW,D } (newops, bw, sz, bbw, sbbw, ibbb, irb, isaf, dsp )
265267 end
266268end
267269
@@ -280,11 +282,12 @@ function TimesOperator(ops::AbstractVector{O},
280282 sbbw:: Tuple{Any,Any} = bandwidthssum (subblockbandwidths, ops),
281283 ibbb:: Bool = all (isbandedblockbanded, ops),
282284 irb:: Bool = all (israggedbelow, ops),
283- isaf:: Bool = sz[1 ] == 1 && isconstspace (rangespace (first (ops)));
285+ isaf:: Bool = sz[1 ] == 1 && isconstspace (rangespace (first (ops))),
286+ dsp = domainspace (last (ops));
284287 anytimesop = any (x -> x isa TimesOperator, ops),
285288 ) where {O<: Operator }
286289 TimesOperator {eltype(O),typeof(bw),typeof(sz),O,typeof(bbw),typeof(sbbw)} (
287- convert_vector (ops), bw, sz, bbw, sbbw, ibbb, irb, isaf; anytimesop)
290+ convert_vector (ops), bw, sz, bbw, sbbw, ibbb, irb, isaf, dsp ; anytimesop)
288291end
289292
290293_extractops (A:: TimesOperator , :: typeof (* )) = A. ops
@@ -300,8 +303,9 @@ function TimesOperator(A::Operator, Bs::Operator...)
300303 bwsum = bandwidthssum (bandwidths, ops)
301304 bbwsum = bandwidthssum (blockbandwidths, ops)
302305 subbbwsum = bandwidthssum (subblockbandwidths, ops)
306+ dsp = domainspace (last (ops))
303307 TimesOperator (convert_vector (v), bwsum, sz,
304- bbwsum, subbbwsum, ibbb, irb, isaf;
308+ bbwsum, subbbwsum, ibbb, irb, isaf, dsp ;
305309 anytimesop)
306310end
307311
@@ -317,7 +321,8 @@ function convert(::Type{Operator{T}}, P::TimesOperator) where {T}
317321 _convertops (Operator{T}, ops),
318322 bandwidths (P), size (P), blockbandwidths (P),
319323 subblockbandwidths (P), isbandedblockbanded (P),
320- israggedbelow (P), P. isafunctional, anytimesop = false ):: Operator{T}
324+ israggedbelow (P), P. isafunctional, domainspace (P),
325+ anytimesop = false ):: Operator{T}
321326 end
322327end
323328
@@ -330,7 +335,7 @@ Base.@constprop :aggressive function promotetimes(opsin,
330335 sz = _timessize (ops)
331336 isaf = sz[1 ] == 1 && isconstspace (rangespace (first (ops)))
332337 anytimesop = any (x -> x isa TimesOperator, ops)
333- TimesOperator (convert_vector (ops), bw, sz, bbw, sbbw, ibbb, irb, isaf; anytimesop)
338+ TimesOperator (convert_vector (ops), bw, sz, bbw, sbbw, ibbb, irb, isaf, dsp ; anytimesop)
334339end
335340maybenarroweltype (:: AbstractVector{Operator{T}} ) where {T} = Operator{T}
336341maybenarroweltype (opsin) = mapreduce (operatortype, promote_type, opsin)
384389 end
385390end
386391
387- domainspace (P:: PlusOrTimesOp ) = domainspace (last (P. ops))
392+ domainspace (P:: PlusOperator ) = domainspace (last (P. ops))
393+ domainspace (T:: TimesOperator ) = T. domainspace
388394rangespace (P:: PlusOrTimesOp ) = rangespace (first (P. ops))
389395
390396domain (P:: TimesOperator ) = commondomain (P. ops)
0 commit comments