Skip to content

Commit

Permalink
adding separate Hx and Hz checks in Gottesman
Browse files Browse the repository at this point in the history
  • Loading branch information
Fe-r-oz committed Mar 16, 2024
1 parent 6527546 commit 9e1cc0f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/ecc/codes/gottesmancode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ code_n(c::Gottesman) = 2^c.j
function parity_checks(c::Gottesman)
rows = c.j + 2
cols = 2^c.j

Hx = falses(rows,cols)
Hz = falses(rows,cols)

Hx[1, :] .= true
Hx[2, :] .= false

if c.j == 3
if c.j == 3
for col in 1:cols
Hx[3, col] = (col % 8 == 1 || col % 8 == 3 || col % 8 == 6) ? 0 : 1
end
Expand Down Expand Up @@ -66,15 +66,15 @@ function parity_checks(c::Gottesman)
end
end
end

for a in 1:cols
Hx[rows, a] = (a % 4 == 0) || (a % 4 == 1) ? 0 : 1
end
end

Hz[1, :] .= false
Hz[2, :] .= true

for i in 3:rows
period = 2^(rows - i)
for a in 1:cols
Expand All @@ -83,9 +83,13 @@ function parity_checks(c::Gottesman)
end
extended_Hx = Matrix{Bool}(Hz)
extended_Hz = Matrix{Bool}(Hx)

num_rows = size(Hx, 1)

fill_array = fill(UInt8(0), num_rows)
Stabilizer(fill_array, extended_Hz, extended_Hx)
end
end

parity_checks_x(c::Gottesman) = c.Hx

parity_checks_z(c::Gottesman) = c.Hz

0 comments on commit 9e1cc0f

Please sign in to comment.