@@ -51,43 +51,30 @@ function QuantumOpticsBase.:⊗(a::Operator,b::LazyTensor)
5151end
5252
5353
54-
5554function QuantumOpticsBase.:⊗ (a:: Operator ,b:: LazySum )
5655 btotal_l = a. basis_l ⊗ b. basis_l
5756 btotal_r = a. basis_r ⊗ b. basis_r
58- ops = Vector {AbstractOperator} (undef,length (b. operators))
59- for i in eachindex (ops)
60- ops[i] = a ⊗ b. operators[i]
61- end
57+ ops = ([a ⊗ op op in b. operators]. .. ,)
6258 LazySum (btotal_l,btotal_r,b. factors,ops)
6359end
6460function QuantumOpticsBase.:⊗ (a:: LazySum ,b:: Operator )
6561 btotal_l = a. basis_l ⊗ b. basis_l
6662 btotal_r = a. basis_r ⊗ b. basis_r
67- ops = Vector {AbstractOperator} (undef,length (a. operators))
68- for i in eachindex (ops)
69- ops[i] = a. operators[i] ⊗ b
70- end
63+ ops = ([op ⊗ b op in a. operators]. .. ,)
7164 LazySum (btotal_l,btotal_r,a. factors,ops)
7265end
7366
7467
7568function QuantumOpticsBase.:⊗ (a:: Operator ,b:: LazyProduct )
7669 btotal_l = a. basis_l ⊗ b. basis_l
7770 btotal_r = a. basis_r ⊗ b. basis_r
78- ops = Vector {AbstractOperator} (undef,length (b. operators))
79- for i in eachindex (ops)
80- ops[i] = a ⊗ b. operators[i]
81- end
71+ ops = ([a ⊗ op op in b. operators]. .. ,)
8272 LazyProduct (btotal_l,btotal_r,b. factor,ops)
8373end
8474function QuantumOpticsBase.:⊗ (a:: LazyProduct ,b:: Operator )
8575 btotal_l = a. basis_l ⊗ b. basis_l
8676 btotal_r = a. basis_r ⊗ b. basis_r
87- ops = Vector {AbstractOperator} (undef,length (a. operators))
88- for i in eachindex (ops)
89- ops[i] = a. operators[i] ⊗ b
90- end
77+ ops = ([op ⊗ b op in a. operators]. .. ,)
9178 LazyProduct (btotal_l,btotal_r,a. factor,ops)
9279end
9380
@@ -105,3 +92,8 @@ function QuantumOpticsBase.:⊗(a::LazyTensor,b::AbstractOperator)
10592 ops = (a. operators... ,b)
10693 LazyTensor (btotal_l,btotal_r,indices,ops,a. factor)
10794end
95+
96+
97+
98+
99+
0 commit comments