@@ -240,8 +240,13 @@ struct TimesOperator{T,BI} <: Operator{T}
240
240
end
241
241
end
242
242
243
- bandwidthssum (P, k) = bandwidthssum (P)[k]
243
+ bandwidthssum (P, k:: Integer ) = bandwidthssum (P)[k]
244
244
bandwidthssum (P) = mapreduce (bandwidths, (t1, t2) -> t1 .+ t2, P, init = (0 ,0 ))
245
+ _bandwidthssum (A:: Operator , B:: Operator ) = __bandwidthssum (bandwidths (A), bandwidths (B))
246
+ __bandwidthssum (A:: NTuple{2,InfiniteCardinal{0}} , B:: NTuple{2,InfiniteCardinal{0}} ) = A
247
+ __bandwidthssum (A:: NTuple{2,InfiniteCardinal{0}} , B) = A
248
+ __bandwidthssum (A, B:: NTuple{2,InfiniteCardinal{0}} ) = B
249
+ __bandwidthssum (A, B) = reduce ((t1, t2) -> t1 .+ t2, (A, B), init = (0 ,0 ))
245
250
246
251
TimesOperator (ops:: Vector{Operator{T}} ,bi:: Tuple{N1,N2} ) where {T,N1,N2} =
247
252
TimesOperator {T,typeof(bi)} (ops,bi)
@@ -251,13 +256,13 @@ TimesOperator(ops::Vector{OT}) where {OT<:Operator} =
251
256
TimesOperator (convert (Vector{Operator{eltype (OT)}},ops),bandwidthssum (ops))
252
257
253
258
TimesOperator (A:: TimesOperator ,B:: TimesOperator ) =
254
- TimesOperator (Operator{promote_type (eltype (A),eltype (B))}[A. ops; B. ops])
259
+ TimesOperator (Operator{promote_type (eltype (A),eltype (B))}[A. ops; B. ops], _bandwidthssum (A, B) )
255
260
TimesOperator (A:: TimesOperator ,B:: Operator ) =
256
- TimesOperator (Operator{promote_type (eltype (A),eltype (B))}[A. ops; B])
261
+ TimesOperator (Operator{promote_type (eltype (A),eltype (B))}[A. ops; B], _bandwidthssum (A, B) )
257
262
TimesOperator (A:: Operator ,B:: TimesOperator ) =
258
- TimesOperator (Operator{promote_type (eltype (A),eltype (B))}[A; B. ops])
263
+ TimesOperator (Operator{promote_type (eltype (A),eltype (B))}[A; B. ops], _bandwidthssum (A, B) )
259
264
TimesOperator (A:: Operator ,B:: Operator ) =
260
- TimesOperator (Operator{promote_type (eltype (A),eltype (B))}[A,B])
265
+ TimesOperator (Operator{promote_type (eltype (A),eltype (B))}[A,B], _bandwidthssum (A, B) )
261
266
262
267
263
268
== (A:: TimesOperator ,B:: TimesOperator )= A. ops== B. ops
0 commit comments