Skip to content

Commit

Permalink
transpose fix
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewware committed Dec 9, 2020
1 parent 5bf9896 commit 4738dca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/open-systems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function liou2pauliliou{T}( m::Matrix{T} )
n = round(Int,log(2,dsq)/2)
for (i,pi) in enumerate(allpaulis(n))
for (j,pj) in enumerate(allpaulis(n))
res[i,j] += trace( m * vec(complex(pi)) * vec(complex(pj))' / sqrt(dsq) )
res[j,i] = vec(complex(pj))' * m * vec(complex(pi)) / sqrt(dsq)
end
end
res
Expand Down
12 changes: 12 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,16 @@ let
@test isapprox(liou2pauliliou(eye(4)), eye(4))
@test isapprox(pauliliou2liou(eye(4)), eye(4))

@testset "Pauli-Liouville" begin
# we expect an X90 to transform +X => +X, +Z => -Y, +Y => +Z
X90 = exp(-1im*π/4*[0 1;1 0])
@test liou2pauliliou(liou(X90)) [1 0 0 0;
0 1 0 0;
0 0 0 -1;
0 0 1 0]

# liou2pauliliou and pauliliou2liou should be inverses
@test pauliliou2liou(liou2pauliliou(liou(X90))) liou(X90)
end

end

2 comments on commit 4738dca

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: "File (Julia)Project.toml not found"

@matthewware
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

Please sign in to comment.