66
66
67
67
domain (P:: PlusOperator ) = commondomain (P. ops)
68
68
69
+ _promote_eltypeof (As... ) = _promote_eltypeof (As)
70
+ _promote_eltypeof (As:: Union{Vector, Tuple} ) = mapreduce (eltype, promote_type, As)
69
71
70
72
+ (A:: PlusOperator ,B:: PlusOperator ) =
71
- promoteplus (Operator{promote_type ( eltype (A), eltype (B) )}[A. ops; B. ops])
73
+ promoteplus (Operator{_promote_eltypeof (A,B )}[A. ops; B. ops])
72
74
+ (A:: PlusOperator ,B:: PlusOperator ,C:: PlusOperator ) =
73
- promoteplus (Operator{promote_type ( eltype (A), eltype (B), eltype (C) )}[A. ops; B. ops; C. ops])
75
+ promoteplus (Operator{_promote_eltypeof (A,B,C )}[A. ops; B. ops; C. ops])
74
76
+ (A:: PlusOperator ,B:: Operator ) =
75
- promoteplus (Operator{promote_type ( eltype (A), eltype (B) )}[A. ops; B])
77
+ promoteplus (Operator{_promote_eltypeof (A,B )}[A. ops; B])
76
78
+ (A:: PlusOperator ,B:: ZeroOperator ) = A
77
79
+ (A:: PlusOperator ,B:: Operator ,C:: Operator ) =
78
- promoteplus (Operator{promote_type ( eltype (A), eltype (B), eltype (C) )}[A. ops; B; C])
80
+ promoteplus (Operator{_promote_eltypeof (A,B,C )}[A. ops; B; C])
79
81
+ (A:: Operator ,B:: PlusOperator ) =
80
- promoteplus (Operator{promote_type ( eltype (A), eltype (B) )}[A; B. ops])
82
+ promoteplus (Operator{_promote_eltypeof (A,B )}[A; B. ops])
81
83
+ (A:: ZeroOperator ,B:: PlusOperator ) = B
82
84
+ (A:: Operator ,B:: Operator ) =
83
- promoteplus (Operator{promote_type ( eltype (A), eltype (B) )}[A,B])
85
+ promoteplus (Operator{_promote_eltypeof (A,B )}[A,B])
84
86
+ (A:: Operator ,B:: Operator ,C:: Operator ) =
85
- promoteplus (Operator{promote_type ( eltype (A), eltype (B), eltype (C) )}[A,B,C])
87
+ promoteplus (Operator{_promote_eltypeof (A,B,C )}[A,B,C])
86
88
87
89
88
90
143
145
for OP in (:+ ,:- )
144
146
@eval begin
145
147
$ OP (c:: Union{UniformScaling,Number} ,A:: Operator ) =
146
- $ OP (convert (Operator{promote_type ( eltype (A), eltype (c) )},c),A)
148
+ $ OP (convert (Operator{_promote_eltypeof (A, c )},c),A)
147
149
$ OP (A:: Operator ,c:: Union{UniformScaling,Number} ) =
148
- $ OP (A,convert (Operator{promote_type ( eltype (A), eltype (c) )},c))
150
+ $ OP (A,convert (Operator{_promote_eltypeof (A, c )},c))
149
151
end
150
152
end
151
153
@@ -256,13 +258,13 @@ TimesOperator(ops::Vector{OT}) where {OT<:Operator} =
256
258
TimesOperator (convert (Vector{Operator{eltype (OT)}},ops),bandwidthssum (ops))
257
259
258
260
TimesOperator (A:: TimesOperator ,B:: TimesOperator ) =
259
- TimesOperator (Operator{promote_type ( eltype (A), eltype (B) )}[A. ops; B. ops], _bandwidthssum (A, B))
261
+ TimesOperator (Operator{_promote_eltypeof (A,B )}[A. ops; B. ops], _bandwidthssum (A, B))
260
262
TimesOperator (A:: TimesOperator ,B:: Operator ) =
261
- TimesOperator (Operator{promote_type ( eltype (A), eltype (B) )}[A. ops; B], _bandwidthssum (A, B))
263
+ TimesOperator (Operator{_promote_eltypeof (A,B )}[A. ops; B], _bandwidthssum (A, B))
262
264
TimesOperator (A:: Operator ,B:: TimesOperator ) =
263
- TimesOperator (Operator{promote_type ( eltype (A), eltype (B) )}[A; B. ops], _bandwidthssum (A, B))
265
+ TimesOperator (Operator{_promote_eltypeof (A,B )}[A; B. ops], _bandwidthssum (A, B))
264
266
TimesOperator (A:: Operator ,B:: Operator ) =
265
- TimesOperator (Operator{promote_type ( eltype (A), eltype (B) )}[A,B], _bandwidthssum (A, B))
267
+ TimesOperator (Operator{_promote_eltypeof (A,B )}[A,B], _bandwidthssum (A, B))
266
268
267
269
268
270
== (A:: TimesOperator ,B:: TimesOperator )= A. ops== B. ops
278
280
279
281
280
282
function promotetimes (opsin:: Vector{B} ,dsp) where B<: Operator
281
- ops= Vector {Operator{mapreduce(eltype,promote_type, opsin)}} (undef,0 )
283
+ ops= Vector {Operator{_promote_eltypeof( opsin)}} (undef,0 )
282
284
283
285
for k= length (opsin): - 1 : 1
284
286
if ! isa (opsin[k],Conversion)
@@ -491,19 +493,19 @@ for OP in (:(adjoint),:(transpose))
491
493
end
492
494
493
495
* (A:: TimesOperator ,B:: TimesOperator ) =
494
- promotetimes (Operator{promote_type ( eltype (A), eltype (B) )}[A. ops; B. ops])
496
+ promotetimes (Operator{_promote_eltypeof (A, B )}[A. ops; B. ops])
495
497
function * (A:: TimesOperator ,B:: Operator )
496
498
if isconstop (B)
497
499
promotedomainspace (convert (Number,B)* A,domainspace (B))
498
500
else
499
- promotetimes (Operator{promote_type ( eltype (A), eltype (B) )}[A. ops; B])
501
+ promotetimes (Operator{_promote_eltypeof (A, B )}[A. ops; B])
500
502
end
501
503
end
502
504
function * (A:: Operator ,B:: TimesOperator )
503
505
if isconstop (A)
504
506
promoterangespace (convert (Number,A)* B,rangespace (A))
505
507
else
506
- promotetimes (Operator{promote_type ( eltype (A), eltype (B) )}[A; B. ops])
508
+ promotetimes (Operator{_promote_eltypeof (A, B )}[A; B. ops])
507
509
end
508
510
end
509
511
function * (A:: Operator ,B:: Operator )
@@ -512,7 +514,7 @@ function *(A::Operator,B::Operator)
512
514
elseif isconstop (B)
513
515
promotedomainspace (convert (Number,B)* A,domainspace (B))
514
516
else
515
- promotetimes (Operator{promote_type ( eltype (A), eltype (B) )}[A,B])
517
+ promotetimes (Operator{_promote_eltypeof (A, B )}[A,B])
516
518
end
517
519
end
518
520
@@ -612,7 +614,7 @@ function promotedomainspace(P::PlusOperator{T},sp::Space,cursp::Space) where T
612
614
P
613
615
else
614
616
ops = [promotedomainspace (op,sp) for op in P. ops]
615
- promoteplus (Vector {Operator{mapreduce(eltype,promote_type, ops)}} (ops))
617
+ promoteplus (Vector {Operator{_promote_eltypeof( ops)}} (ops))
616
618
end
617
619
end
618
620
0 commit comments