diff --git a/src/ecc/codes/gottesmancode.jl b/src/ecc/codes/gottesmancode.jl index 461e33779..eb230e045 100644 --- a/src/ecc/codes/gottesmancode.jl +++ b/src/ecc/codes/gottesmancode.jl @@ -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 @@ -66,7 +66,7 @@ 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 @@ -74,7 +74,7 @@ function parity_checks(c::Gottesman) Hz[1, :] .= false Hz[2, :] .= true - + for i in 3:rows period = 2^(rows - i) for a in 1:cols @@ -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 \ No newline at end of file +end + +parity_checks_x(c::Gottesman) = c.Hx + +parity_checks_z(c::Gottesman) = c.Hz