Skip to content

Commit 7a1638c

Browse files
Fix gellmann normalisation wrt Ket v0.8.0
1 parent f234054 commit 7a1638c

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "EntanglementDetection"
22
uuid = "5e5e84d8-5f53-4fe3-9037-c06c4de5d74e"
33
authors = ["Y.C. Liu <yechaoliu1994@outlook.com> and contributors"]
4-
version = "0.2.0"
4+
version = "0.2.1"
55

66
[deps]
77
FrankWolfe = "f55ce6ea-fdc5-4628-88c5-0087fe54bd30"
@@ -20,7 +20,7 @@ EntanglementDetectionTullio = "Tullio"
2020
[compat]
2121
DoubleFloats = "1.4.0"
2222
FrankWolfe = "0.6"
23-
Ket = "0.7"
23+
Ket = "0.8"
2424
LinearAlgebra = "1"
2525
Printf = "1"
2626
Quadmath = "0.5.13"

src/utils.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
# Ket does not normalise gellmann the same way we do, the first element of tensor should be treated differently
2-
function _gellmann(::Type{CT}, dims::NTuple{N, Int}) where {CT <: Number, N}
2+
function _gellmann(::Type{CT}, dims::NTuple{N, Int}; coeff = 1) where {CT <: Number, N}
33
T = float(real(CT))
4-
matrix_basis = broadcast.(Matrix{Complex{T}}, Ket.gellmann.(Complex{T}, dims))
5-
for n in 1:N
6-
matrix_basis[n][1] .*= sqrt(T(2)) / sqrt(T(dims[n]))
7-
end
4+
matrix_basis = broadcast.(Matrix{Complex{T}}, Ket.gellmann.(Complex{T}, dims; coeff))
85
return matrix_basis
96
end
107

test/unit.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ end
2626
@test isa(lmo, EntanglementDetection.SeparableLMO{T, N})
2727
@test isa(lmo, EntanglementDetection.AlternatingSeparableLMO{T, N})
2828
@test lmo.dims == dims
29-
@test lmo.matrix_basis[1][2:end] == Ket.gellmann.(CT, dims)[1][2:end]
30-
@test lmo.matrix_basis[2][1] == Ket.gellmann.(CT, dims[2])[1] * sqrt(T(2)) / sqrt(T(dims[2]))
29+
@test lmo.matrix_basis[1][2:end] == Ket.gellmann.(CT, dims; coeff = 1)[1][2:end]
30+
@test lmo.matrix_basis[2][1] == Ket.gellmann.(CT, dims[2]; coeff = 1)[1]
3131
ρ = Matrix(Ket.proj(CT, 1, prod(dims)))
3232
v = FrankWolfe.compute_extreme_point(lmo, EntanglementDetection.correlation_tensor(LA.I / prod(dims) - ρ, dims))
3333
@test EntanglementDetection.density_matrix(v) ρ

0 commit comments

Comments
 (0)