Skip to content

Commit 78bfcbd

Browse files
ytdHuangalbertomercurio
authored andcommitted
fix element type for steadystate
1 parent 18524a6 commit 78bfcbd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/steadystate.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,14 @@ function steadystate(
9595
(H.dims != ψ0.dims) && throw(DimensionMismatch("The two quantum objects are not of the same Hilbert dimension."))
9696

9797
N = prod(H.dims)
98-
u0 = mat2vec(ket2dm(ψ0).data)
98+
u0 = _convert_u0(mat2vec(ket2dm(ψ0).data))
99+
100+
Ftype = real(eltype(u0))
101+
Tspan = (convert(Ftype, 0), convert(Ftype, tspan))
102+
99103
L = MatrixOperator(liouvillian(H, c_ops).data)
100104

101-
prob = ODEProblem{true}(L, u0, (0.0, tspan))
105+
prob = ODEProblem{true}(L, u0, Tspan)
102106
sol = solve(
103107
prob,
104108
solver.alg;
@@ -109,7 +113,6 @@ function steadystate(
109113
)
110114

111115
ρss = reshape(sol.u[end], N, N)
112-
ρss = (ρss + ρss') / 2 # Hermitianize
113116
return QuantumObject(ρss, Operator, H.dims)
114117
end
115118

0 commit comments

Comments
 (0)