Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't reshape into drho in steadystate.iterative #316

Merged
merged 1 commit into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "QuantumOptics"
uuid = "6e0679c1-51ea-5a7c-ac74-d61b76210b0c"
version = "v1.0.0"
version = "v1.0.1"

[deps]
Arpack = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97"
Expand Down
3 changes: 1 addition & 2 deletions src/steadystate_iterative.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,11 @@ function _linmap_liouvillian(rho,H,J,Jdagger,rates)
# Linear mapping
function f!(y,x)
# Reshape
drho.data .= @views reshape(y[1:end-1], M, M)
rho.data .= @views reshape(x[1:end-1], M, M)
# Apply function
dmaster_(drho,rho)
# Recast data
@views y[1:end-1] .= reshape(drho.data, M^2)
copyto!(y, 1, drho.data, 1, M^2)
y[end] = tr(rho)
return y
end
Expand Down
12 changes: 12 additions & 0 deletions test/test_steadystate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ steadystate.iterative!(ρss32, Hdense32, Jdense32)
ρt32 = DenseOperator(ρt[end].basis_l, ρt[end].basis_r, Matrix{ComplexF32}(ρt[end].data))
@test tracedistance(ρss32, ρt[end]) < 2*1e-3

ρbig = Operator(basis, basis, Matrix{Complex{BigFloat}}(ρ₀.data))
Hbig = Operator(basis, basis, Matrix{Complex{BigFloat}}(H.data))
Jbig = [Operator(basis, basis, Matrix{Complex{BigFloat}}(j.data)) for j ∈ J]
steadystate.iterative!(ρbig, Hbig, Jbig)
@test ρbig.data[2,2] ≈ 1
check = Ref(true)
for i=1:size(ρbig, 1), j=1:size(ρbig, 2)
2==i==j && continue
check[] = iszero(ρbig.data[i,j])
end
@test check[]

# Iterative methods with lazy operators
Hlazy = LazySum(Ha, Hc, Hint)
Ja_lazy = LazyTensor(basis, 1, sqrt(γ)*sm)
Expand Down