diff --git a/src/ecc/ECC.jl b/src/ecc/ECC.jl index cdda7742e..d9521463f 100644 --- a/src/ecc/ECC.jl +++ b/src/ecc/ECC.jl @@ -380,6 +380,7 @@ include("codes/classical/reedmuller.jl") include("codes/classical/recursivereedmuller.jl") include("codes/classical/bch.jl") include("codes/quantumreedmuller.jl") +include("codes/gottesman4.jl") # qLDPC include("codes/classical/lifted.jl") diff --git a/src/ecc/codes/gottesman4.jl b/src/ecc/codes/gottesman4.jl new file mode 100644 index 000000000..2050c8bc8 --- /dev/null +++ b/src/ecc/codes/gottesman4.jl @@ -0,0 +1,25 @@ +"""The family of `[[2ʲ, 2ʲ - 2j - 2, 4]]` Gottesman codes, also known as a 'Class of Distance Four Codes', as described in [Gottesman's 1997 PhD thesis](@cite gottesman1997stabilizer) and in [gottesman1996class](@cite). + +The stabilizer generators of the original `[[2ʲ, 2ʲ - j - 2, 3]]` Gottesman codes are incorporated to create a set of generators for this distance-four code. The resulting stabilizer set, denoted by S, incorporates the following elements: The first two generators are the Pauli-`X` and Pauli-`Z` operators acting on all qubits, represented by `Mₓ` and `Mz`, respectively. The next `j` generators correspond to `M₁` through `Mⱼ`, which are directly inherited from the `[[2ʲ, 2ʲ - j - 2, 3]]` Gottesman code's stabilizers. This inclusion ensures that `S` retains the inherent distance-three property of the original Gottesman code. The final `j` generators are defined as `Nᵢ = RMᵢR`, where `i` ranges from `1` to `j`. Here, `R` signifies a Hadamard Rotation operation applied to all `2ʲ` qubits, and `Mᵢ` refers to one of the existing generators from the second set `(M₁ to Mⱼ)`. By incorporating the stabilizers of a distance-three code, the constructed set `S` inherently guarantees a minimum distance of three for the resulting distance-four Gottesman code. +""" +struct Gottesman4 <: AbstractECC + j::Int + function Gottesman4(j) + (j >= 3 && j < 21) || error("In `Gottesman4(j)`, `j` must be ≥ 3 in order to obtain a valid code and < 21 to remain tractable") + new(j) + end +end + +code_n(c::Gottesman4) = 2^c.j +code_k(c::Gottesman4) = 2^c.j - 2*c.j - 2 +distance(c::Gottesman4) = 4 + +function parity_checks(c::Gottesman4) + H₁ = parity_checks(Gottesman(c.j)) + Hⱼ = H₁[3:end] + for qᵢ in 1:nqubits(Hⱼ) + apply!(Hⱼ, sHadamard(qᵢ)) + end + H = vcat(H₁, Hⱼ) + Stabilizer(H) +end diff --git a/test/test_ecc_base.jl b/test/test_ecc_base.jl index 6dd7e5162..b81efc185 100644 --- a/test/test_ecc_base.jl +++ b/test/test_ecc_base.jl @@ -1,6 +1,6 @@ using Test using QuantumClifford -using QuantumClifford.ECC +using QuantumClifford.ECC: Gottesman4 using InteractiveUtils import Nemo: GF @@ -60,11 +60,13 @@ const code_instance_args = Dict( Toric => [(3,3), (4,4), (3,6), (4,3), (5,5)], Surface => [(3,3), (4,4), (3,6), (4,3), (5,5)], Gottesman => [3, 4, 5], + CSS => (c -> (parity_checks_x(c), parity_checks_z(c))).([Shor9(), Steane7(), Toric(4,4)]), CSS => (c -> (parity_checks_x(c), parity_checks_z(c))).([Shor9(), Steane7(), Toric(4, 4)]), Concat => [(Perfect5(), Perfect5()), (Perfect5(), Steane7()), (Steane7(), Cleve8()), (Toric(2, 2), Shor9())], CircuitCode => random_circuit_code_args, LPCode => (c -> (c.A, c.B)).(vcat(LP04, LP118, test_gb_codes, other_lifted_product_codes)), - QuantumReedMuller => [3, 4, 5] + QuantumReedMuller => [3, 4, 5], + Gottesman4 => [4, 5, 6, 7, 8] ) function all_testablable_code_instances(;maxn=nothing)