You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Request For Comment: Arithemtic between Operators and LazyOperators (#86)
Extend some of the current operation with LazyOperators to allow for smoother interface with e.g. LazyTensor. As an example +(a::LazyTensor,LazyTensor) now returns LazySum.
throw(ArgumentError("Subtraction of LazyTensor operators is only defined in case both operators act nontrivially on the same, single tensor factor."))
112
+
LazySum(a) -LazySum(b)
113
+
end
114
+
115
+
functiontensor(a::LazyTensor{B1,B2},b::AbstractOperator{B3,B4}) where {B1,B2,B3,B4}
116
+
if B3 <:CompositeBasis|| B4 <:CompositeBasis
117
+
throw(ArgumentError("tensor(a::LazyTensor{B1,B2},b::AbstractOperator{B3,B4}) is not implemented for B3 or B4 being CompositeBasis unless b is identityoperator "))
118
+
else
119
+
a ⊗LazyTensor(b.basis_l,b.basis_r,[1],(b,),1)
120
+
end
113
121
end
122
+
functiontensor(a::AbstractOperator{B1,B2},b::LazyTensor{B3,B4}) where {B1,B2,B3,B4}
123
+
if B1 <:CompositeBasis|| B2 <:CompositeBasis
124
+
throw(ArgumentError("tensor(a::AbstractOperator{B1,B2},b::LazyTensor{B3,B4}) is not implemented for B1 or B2 being CompositeBasis unless b is identityoperator "))
125
+
else
126
+
LazyTensor(a.basis_l,a.basis_r,[1],(a,),1) ⊗ b
127
+
end
128
+
end
129
+
114
130
115
131
function*(a::LazyTensor{B1,B2}, b::LazyTensor{B2,B3}) where {B1,B2,B3}
0 commit comments