Skip to content

Commit

Permalink
simplify partial_transpose
Browse files Browse the repository at this point in the history
  • Loading branch information
lucporto committed Jun 18, 2024
1 parent dd87589 commit 6c957f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/partial_tra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ export partial_trace
Takes the partial transpose of matrix `X` with subsystem dimensions `dims` on the subsystems in `transp`.
""" partial_transpose

for (T, symmetry, wrapper) in
[(:AbstractMatrix, :false, :identity), (:(LA.Hermitian), :true, :(LA.Hermitian)), (:(LA.Symmetric), :true, :(LA.Symmetric))]
for (T, wrapper) in
[(:AbstractMatrix, :identity), (:(LA.Hermitian), :(LA.Hermitian)), (:(LA.Symmetric), :(LA.Symmetric))]
@eval begin
function partial_transpose(X::$T, transp::Vector{<:Integer}, dims::Vector{<:Integer})
isempty(transp) && return X
Expand Down Expand Up @@ -161,7 +161,7 @@ for (T, symmetry, wrapper) in

Xi, Xj = _idx(tXi, dims), _idx(tXj, dims)
Y[i, j] = X[Xi, Xj]
!($symmetry) && (Y[j, i] = X[Xj, Xi])
i != j && (Y[j, i] = X[Xj, Xi])
end
end
return $wrapper(Y)
Expand Down
2 changes: 1 addition & 1 deletion test/partial_tra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
end
end

@testset "Partial Transpose" begin
@testset "Partial transpose" begin
d1, d2, d3 = 2, 3, 4
for R in [Float64, Double64, Float128, BigFloat]
for T in [R, Complex{R}]
Expand Down

0 comments on commit 6c957f1

Please sign in to comment.