diff --git a/src/ecc/ECC.jl b/src/ecc/ECC.jl index 4637c85b4..3bead2351 100644 --- a/src/ecc/ECC.jl +++ b/src/ecc/ECC.jl @@ -397,6 +397,8 @@ include("codes/util.jl") include("codes/concat.jl") include("codes/random_circuit.jl") include("codes/classical/bch.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 8e0e192c1..4f6e857a0 100644 --- a/test/test_ecc_base.jl +++ b/test/test_ecc_base.jl @@ -1,8 +1,9 @@ using Test using QuantumClifford.ECC.QECCore using QuantumClifford -using QuantumClifford.ECC -using QuantumClifford.ECC: check_repr_commutation_relation, check_repr_regular_linear +using QuantumClifford.ECC: +using QuantumClifford.ECC: check_repr_commutation_relation, check_repr_regular_linear, Gottesman4 + using InteractiveUtils using SparseArrays @@ -325,9 +326,9 @@ const code_instance_args = Dict( :QuantumTannerGraphProduct => [(H1, H2),(H2, H2), (H1, H1), (H2, H1)], :CyclicQuantumTannerGraphProduct => [1, 2, 3, 4, 5], :DDimensionalSurfaceCode => [(2, 2), (2, 3), (3, 2), (3, 3), (4, 2)], - :DDimensionalToricCode => [(2, 2), (2, 3), (3, 2), (3, 3), (4, 2)] + :DDimensionalToricCode => [(2, 2), (2, 3), (3, 2), (3, 3), (4, 2)], + :Gottesman4 => [4, 5, 6, 7, 8] ) - function all_testablable_code_instances(;maxn=nothing) codeinstances = [] i = 1