Skip to content

Commit

Permalink
Clean up broken tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Krastanov committed Jul 3, 2022
1 parent 55c079f commit 910d215
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 22 deletions.
8 changes: 4 additions & 4 deletions src/QuantumClifford.jl
Original file line number Diff line number Diff line change
Expand Up @@ -524,19 +524,19 @@ end

# Added a lot of type assertions to help Julia infer types
function MixedDestabilizer(stab::Stabilizer{Tv,Tm}; undoperm=true) where {Tve,Tme,Tv<:AbstractVector{Tve},Tm<:AbstractMatrix{Tme}}
r,n = size(stab)
rows,n = size(stab)
stab, r, s, permx, permz = canonicalize_gott!(copy(stab))
n = nqubits(stab)
tab = zero(Stabilizer, n*2, n)::Stabilizer{Vector{Tve},Matrix{Tme}}
tab[n+1:n+r+s] = stab # The Stabilizer part of the tableau
vstab = @view stab[1:r+s] # this view is necessary for cases of tableaux with redundant rows
tab[n+1:n+r+s] = vstab # The Stabilizer part of the tableau
for i in 1:r # The Destabilizer part
tab[i,i] = (false,true)
end
for i in r+1:r+s
tab[i,i] = (true,false)
end
if r+s!=n
H = stab_to_gf2(stab) # n-k × 2n
H = stab_to_gf2(vstab) # n-k × 2n
k = n - r - s
E = H[r+1:end,end÷2+r+s+1:end] # n-k-r × n-r-s
C1 = H[1:r,end÷2+r+1:end÷2+r+s] # r × s
Expand Down
4 changes: 0 additions & 4 deletions test/test_projections.jl
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,6 @@ function test_projections()
@test generate!(P"_Z", S"XZ") === nothing # for bug fixed in 4b536231c3ee4e6446262fcc61ba8da669415bc8
for n in test_sizes
for r in [n, rand(n÷3:n*2÷3)]
if r==0
@test_broken error("can not process empty stab")
continue
end
s = random_stabilizer(r,n)
ms = MixedStabilizer(copy(s))
d = Destabilizer(copy(s))
Expand Down
4 changes: 0 additions & 4 deletions test/test_stabcanon.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ function test_stabcanon()
@testset "Canonicalization of complex tableaus" begin
for n in test_sizes
for nrows in [n, rand(n÷3:n*2÷3)]
if nrows==0
@test_broken error("can not process empty stab")
continue
end
rs = random_stabilizer(nrows,n)
rs_m = MixedStabilizer(copy(rs))
rs_d = Destabilizer(copy(rs))
Expand Down
12 changes: 6 additions & 6 deletions test/test_stabs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ function test_stabs()
end
# Test initialization out of overdetermined stabs
stabs = [S"XX
II",
S"XX
XX",
S"ZZ
ZZ"]
II",
S"XX
XX",
S"ZZ
ZZ"]
for s in stabs
md = MixedDestabilizer(s[1:1])
@test_broken MixedDestabilizer(s) == md
@test MixedDestabilizer(s) == md
end
end
end
Expand Down
4 changes: 0 additions & 4 deletions test/test_trace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ function test_trace()
@testset "RREF canonicalization vs manual traceout" begin
for N in test_sizes
for n in [N,rand(N÷4:N÷2)]
if n==0
@test_broken error("can not process empty stab")
continue
end
to_delete = randperm(N)[1:rand(N÷4:N÷2)]
stab0 = random_stabilizer(n, N)
id_paulis = zero(PauliOperator, N)
Expand Down

0 comments on commit 910d215

Please sign in to comment.