Skip to content

Commit 148182c

Browse files
committed
Merge branch 'liouvillian' of https://github.com/qutip/QuantumToolbox.jl into liouvillian
2 parents c3026d6 + cc83820 commit 148182c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/qobj/superoperators.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ end
4343
_liouvillian(H::MT, Id::AbstractMatrix) where {MT<:Union{AbstractMatrix,AbstractSciMLOperator}} =
4444
-1im * _spre(H, Id) + 1im * _spost(H', Id) # without extracting the prefactor -1im seems to be better for AbstractSciMLOperator
4545
_liouvillian(H::MatrixOperator, Id::AbstractMatrix) = MatrixOperator(_liouvillian(H.A, Id))
46+
-1im * (_spre(H, Id) - _spost(H', Id))
47+
_liouvillian(H::MatrixOperator, Id::AbstractMatrix) = MatrixOperator(_liouvillian(H.A, Id))
48+
_liouvillian(H::ScaledOperator, Id::AbstractMatrix) =
49+
-1im * (ScaledOperator(H.λ, _spre(H.L, Id)) - ScaledOperator(conj(H.λ), _spost(H.L', Id)))
4650
_liouvillian(H::AddedOperator, Id::AbstractMatrix) = AddedOperator(map(op -> _liouvillian(op, Id), H.ops))
4751

4852
# intrinsic lindblad_dissipator

test/core-test/quantum_objects_evo.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
X = a * a'
208208
c_op1 = QobjEvo(a', coef1)
209209
c_op2 = QobjEvo(((a, coef2), (X, coef3)))
210-
c_ops = [c_op1, c_op2]
210+
c_ops = (c_op1, c_op2)
211211
D1_ti = abs2(coef1(p, t)) * lindblad_dissipator(a')
212212
D2_ti =
213213
abs2(coef2(p, t)) * lindblad_dissipator(a) + # normal dissipator for first element in c_op2
@@ -237,10 +237,9 @@
237237
@test_throws ArgumentError cache_operator(L_td, ψ)
238238

239239
@testset "Type Inference" begin
240-
# we use destroy and create here because they somehow causes type instability before
241-
H_td2 = H_td + QobjEvo(destroy(N) + create(N), coef3)
242-
c_ops1 = (destroy(N), create(N))
243-
c_ops2 = (destroy(N), QobjEvo(create(N), coef1))
240+
H_td2 = H_td + QobjEvo(a + a', coef3)
241+
c_ops1 = (a, a')
242+
c_ops2 = (a, QobjEvo(a', coef1))
244243

245244
@inferred liouvillian(H_td, c_ops1)
246245
# @inferred liouvillian(H_td, c_ops2)

0 commit comments

Comments
 (0)