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
*(a::Operator{B1, B2, T}, b::DataOperator{B2, B3}) where {B1, B2, B3, T} =error("no `*` method defined for DataOperator subtype $(typeof(b))") # defined to avoid method ambiguity
function*(op1::AbstractOperator{B1,B2}, op2::Operator{B2,B3,T}) where {B1,B2,B3,T}
104
+
function*(op1::BLROperator{B1,B2}, op2::Operator{B2,B3,T}) where {B1,B2,B3,T}
102
105
result =Operator{B1,B3}(op1.basis_l, op2.basis_r, similar(_parent(op2.data),promote_type(eltype(op1),eltype(op2)),length(op1.basis_l),length(op2.basis_r)))
103
106
mul!(result,op1,op2)
104
107
return result
105
108
end
106
-
function*(op1::Operator{B1,B2,T}, op2::AbstractOperator{B2,B3}) where {B1,B2,B3,T}
109
+
function*(op1::Operator{B1,B2,T}, op2::BLROperator{B2,B3}) where {B1,B2,B3,T}
107
110
result =Operator{B1,B3}(op1.basis_l, op2.basis_r, similar(_parent(op1.data),promote_type(eltype(op1),eltype(op2)),length(op1.basis_l),length(op2.basis_r)))
108
111
mul!(result,op1,op2)
109
112
return result
110
113
end
111
-
function*(op::AbstractOperator{BL,BR}, psi::Ket{BR,T}) where {BL,BR,T}
114
+
function*(op::BLROperator{BL,BR}, psi::Ket{BR,T}) where {BL,BR,T}
112
115
result =Ket{BL,T}(op.basis_l,similar(psi.data,length(op.basis_l)))
113
116
mul!(result,op,psi)
114
117
return result
115
118
end
116
-
function*(psi::Bra{BL,T}, op::AbstractOperator{BL,BR}) where {BL,BR,T}
119
+
function*(psi::Bra{BL,T}, op::BLROperator{BL,BR}) where {BL,BR,T}
117
120
result =Bra{BR,T}(op.basis_r, similar(psi.data,length(op.basis_r)))
118
121
mul!(result,psi,op)
119
122
return result
@@ -388,7 +391,7 @@ mul!(result::Bra{B2},a::Bra{B1},b::Operator{B1,B2},alpha,beta) where {B1,B2} = (
388
391
rmul!(op::Operator, x) = (rmul!(op.data, x); op)
389
392
390
393
# Multiplication for Operators in terms of their gemv! implementation
391
-
functionmul!(result::Operator{B1,B3},M::AbstractOperator{B1,B2},b::Operator{B2,B3},alpha,beta) where {B1,B2,B3}
394
+
functionmul!(result::Operator{B1,B3},M::BLROperator{B1,B2},b::Operator{B2,B3},alpha,beta) where {B1,B2,B3}
392
395
for i=1:size(b.data, 2)
393
396
bket =Ket(b.basis_l, b.data[:,i])
394
397
resultket =Ket(M.basis_l, result.data[:,i])
@@ -398,7 +401,7 @@ function mul!(result::Operator{B1,B3},M::AbstractOperator{B1,B2},b::Operator{B2,
398
401
return result
399
402
end
400
403
401
-
functionmul!(result::Operator{B1,B3},b::Operator{B1,B2},M::AbstractOperator{B2,B3},alpha,beta) where {B1,B2,B3}
404
+
functionmul!(result::Operator{B1,B3},b::Operator{B1,B2},M::BLROperator{B2,B3},alpha,beta) where {B1,B2,B3}
Base.copy(x::LazyTensor) =LazyTensor(x.basis_l, x.basis_r, copy(x.indices), Tuple(copy(op) for op in x.operators), x.factor)
60
63
function Base.eltype(x::LazyTensor)
61
64
F =eltype(x.factor)
@@ -112,14 +115,14 @@ function -(a::T1,b::T2) where {T1 <: single_dataoperator{B1,B2},T2 <: single_dat
112
115
LazySum(a) -LazySum(b)
113
116
end
114
117
115
-
functiontensor(a::LazyTensor{B1,B2},b::AbstractOperator{B3,B4}) where {B1,B2,B3,B4}
118
+
functiontensor(a::LazyTensor{B1,B2},b::BLROperator{B3,B4}) where {B1,B2,B3,B4}
116
119
if B3 <:CompositeBasis|| B4 <:CompositeBasis
117
120
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
121
else
119
122
a ⊗LazyTensor(b.basis_l,b.basis_r,[1],(b,),1)
120
123
end
121
124
end
122
-
functiontensor(a::AbstractOperator{B1,B2},b::LazyTensor{B3,B4}) where {B1,B2,B3,B4}
125
+
functiontensor(a::BLROperator{B1,B2},b::LazyTensor{B3,B4}) where {B1,B2,B3,B4}
123
126
if B1 <:CompositeBasis|| B2 <:CompositeBasis
124
127
throw(ArgumentError("tensor(a::AbstractOperator{B1,B2},b::LazyTensor{B3,B4}) is not implemented for B1 or B2 being CompositeBasis unless b is identityoperator "))
0 commit comments