@@ -282,19 +282,14 @@ end
282
282
283
283
const PlusOrTimesOp = Union{PlusOperator,TimesOperator}
284
284
285
- bandwidthssum (P, f= bandwidths) = mapreduce (f, (t1, t2) -> t1 .+ t2, P, init= (0 , 0 ))
286
- _bandwidthssum (A:: Operator , B:: Operator , f= bandwidths) = __bandwidthssum (f (A), f (B))
287
- __bandwidthssum (A:: NTuple{2,InfiniteCardinal{0}} , B:: NTuple{2,InfiniteCardinal{0}} ) = A
288
- __bandwidthssum (A:: NTuple{2,InfiniteCardinal{0}} , B) = A
289
- __bandwidthssum (A, B:: NTuple{2,InfiniteCardinal{0}} ) = B
290
- __bandwidthssum (A, B) = reduce ((t1, t2) -> t1 .+ t2, (A, B), init= (0 , 0 ))
285
+ bandwidthssum (f, ops) = mapfoldl (f, (t1, t2) -> t1 .+ t2, ops, init= (0 , 0 ))
291
286
292
287
_timessize (ops) = (size (first (ops), 1 ), size (last (ops), 2 ))
293
288
function TimesOperator (ops:: AbstractVector{O} ,
294
- bw:: Tuple{Any,Any} = bandwidthssum (ops),
289
+ bw:: Tuple{Any,Any} = bandwidthssum (bandwidths, ops),
295
290
sz:: Tuple{Any,Any} = _timessize (ops),
296
- bbw:: Tuple{Any,Any} = bandwidthssum (ops, blockbandwidths ),
297
- sbbw:: Tuple{Any,Any} = bandwidthssum (ops, subblockbandwidths ),
291
+ bbw:: Tuple{Any,Any} = bandwidthssum (blockbandwidths, ops ),
292
+ sbbw:: Tuple{Any,Any} = bandwidthssum (subblockbandwidths, ops ),
298
293
ibbb:: Bool = all (isbandedblockbanded, ops),
299
294
irb:: Bool = all (israggedbelow, ops),
300
295
isaf:: Bool = sz[1 ] == 1 && isconstspace (rangespace (first (ops)));
@@ -306,16 +301,19 @@ end
306
301
307
302
_extractops (A:: TimesOperator , :: typeof (* )) = A. ops
308
303
309
- function TimesOperator (A:: Operator , B:: Operator )
310
- v = collateops (* , A, B)
311
- ibbb = all (isbandedblockbanded, (A, B))
312
- irb = all (israggedbelow, (A, B))
313
- sz = _timessize ((A, B))
304
+ function TimesOperator (A:: Operator , Bs:: Operator... )
305
+ ops = (A, Bs... )
306
+ v = collateops (* , ops... )
307
+ ibbb = all (isbandedblockbanded, ops)
308
+ irb = all (israggedbelow, ops)
309
+ sz = _timessize (ops)
314
310
isaf = sz[1 ] == 1 && isconstspace (rangespace (A))
315
- anytimesop = any (x -> x isa TimesOperator, (A,B))
316
- TimesOperator (convert_vector (v), _bandwidthssum (A, B), sz,
317
- _bandwidthssum (A, B, blockbandwidths),
318
- _bandwidthssum (A, B, subblockbandwidths), ibbb, irb, isaf;
311
+ anytimesop = any (x -> x isa TimesOperator, ops)
312
+ bwsum = bandwidthssum (bandwidths, ops)
313
+ bbwsum = bandwidthssum (blockbandwidths, ops)
314
+ subbbwsum = bandwidthssum (subblockbandwidths, ops)
315
+ TimesOperator (convert_vector (v), bwsum, sz,
316
+ bbwsum, subbbwsum, ibbb, irb, isaf;
319
317
anytimesop)
320
318
end
321
319
@@ -368,8 +366,8 @@ function __promotetimes(opsin, dsp, anytimesop)
368
366
end
369
367
end
370
368
end
371
- reverse! (ops), bandwidthssum (ops), bandwidthssum (ops, blockbandwidths ),
372
- bandwidthssum (ops, subblockbandwidths ), all (isbandedblockbanded, ops),
369
+ reverse! (ops), bandwidthssum (bandwidths, ops), bandwidthssum (blockbandwidths, ops ),
370
+ bandwidthssum (subblockbandwidths, ops ), all (isbandedblockbanded, ops),
373
371
all (israggedbelow, ops)
374
372
end
375
373
@inline function _op_bws (op)
396
394
op2_dsp = op2: dsp
397
395
op1_dsp = op1: rangespace (op2_dsp)
398
396
ops = (op1_dsp, op2_dsp)
399
- return ops, bandwidthssum (ops),
400
- bandwidthssum (ops, blockbandwidths ),
401
- bandwidthssum (ops, subblockbandwidths ),
397
+ return ops, bandwidthssum (bandwidths, ops),
398
+ bandwidthssum (blockbandwidths, ops ),
399
+ bandwidthssum (subblockbandwidths, ops ),
402
400
all (isbandedblockbanded, ops),
403
401
all (israggedbelow, ops)
404
402
end
653
651
* (A:: Conversion , B:: Operator ) =
654
652
isconstop (B) ? promotedomainspace (strictconvert (Number, B) * A, domainspace (B)) : TimesOperator (A, B)
655
653
654
+ function * (A:: Conversion , B:: Operator , C:: Conversion )
655
+ TimesOperator (A, B, C)
656
+ end
657
+
656
658
@inline function ^ (A:: Operator , p:: Integer )
657
659
p < 0 && return ^ (inv (A), - p)
658
660
p == 0 && return ConstantOperator (one (eltype (A)), domainspace (A))
0 commit comments