From 86e622f4bbeafa7f9f259896f1f0e5fdc2d1ffce Mon Sep 17 00:00:00 2001 From: Fe-r-oz Date: Fri, 11 Oct 2024 01:31:07 +0500 Subject: [PATCH 1/7] Haah's cubic code --- docs/src/references.bib | 11 ++++++++++ docs/src/references.md | 1 + .../QuantumCliffordHeckeExt.jl | 2 +- ext/QuantumCliffordHeckeExt/lifted_product.jl | 20 +++++++++++++++++++ src/ecc/ECC.jl | 1 + src/ecc/codes/lifted_product.jl | 3 +++ test/test_ecc_base.jl | 6 +++++- 7 files changed, 42 insertions(+), 2 deletions(-) diff --git a/docs/src/references.bib b/docs/src/references.bib index 29500a034..78708ea68 100644 --- a/docs/src/references.bib +++ b/docs/src/references.bib @@ -487,3 +487,14 @@ @article{anderson2014fault year={2014}, publisher={APS} } + +@article{haah2011local, + title={Local stabilizer codes in three dimensions without string logical operators}, + author={Haah, Jeongwan}, + journal={Physical Review A?Atomic, Molecular, and Optical Physics}, + volume={83}, + number={4}, + pages={042330}, + year={2011}, + publisher={APS} +} diff --git a/docs/src/references.md b/docs/src/references.md index 35e944a21..f47955271 100644 --- a/docs/src/references.md +++ b/docs/src/references.md @@ -40,6 +40,7 @@ For quantum code construction routines: - [steane1999quantum](@cite) - [campbell2012magic](@cite) - [anderson2014fault](@cite) +- [haah2011local](@cite) For classical code construction routines: - [muller1954application](@cite) diff --git a/ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl b/ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl index 29e9de8ce..731734807 100644 --- a/ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl +++ b/ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl @@ -11,7 +11,7 @@ import Nemo: characteristic, matrix_repr, GF, ZZ, lift import QuantumClifford.ECC: AbstractECC, CSS, ClassicalCode, hgp, code_k, code_n, code_s, iscss, parity_checks, parity_checks_x, parity_checks_z, parity_checks_xz, - two_block_group_algebra_codes, generalized_bicycle_codes, bicycle_codes + two_block_group_algebra_codes, generalized_bicycle_codes, bicycle_codes, Haah_cubic_codes include("types.jl") include("lifted.jl") diff --git a/ext/QuantumCliffordHeckeExt/lifted_product.jl b/ext/QuantumCliffordHeckeExt/lifted_product.jl index 97e41b044..377a25b7d 100644 --- a/ext/QuantumCliffordHeckeExt/lifted_product.jl +++ b/ext/QuantumCliffordHeckeExt/lifted_product.jl @@ -185,3 +185,23 @@ function bicycle_codes(a_shifts::Array{Int}, l::Int) a = sum(GA[n÷l+1] for n in a_shifts) two_block_group_algebra_codes(a, a') end + +""" +Haah’s cubic codes [haah2011local](@cite) can be viewed as GB codes +with the group `G = Cₗ × Cₗ × Cₗ`, where `l` denotes the lattice size. +In particular, a GB code with the group `G = ℤ₃ˣ³` corresponds to a +cubic code [https://errorcorrectionzoo.org/c/haah_cubic](@cite). + +```jldoctest +julia> c = Haah_cubic_codes([0, 15, 20, 28, 66], [0, 58, 59, 100, 121], 6); + +julia> code_n(c), code_k(c) +(432, 8) +``` +""" +function Haah_cubic_codes(a_shifts::Array{Int}, b_shifts::Array{Int}, l::Int) + GA = group_algebra(GF(2), abelian_group([l,l,l])) + a = sum(GA[n%dim(GA)+1] for n in a_shifts) + b = sum(GA[n%dim(GA)+1] for n in b_shifts) + two_block_group_algebra_codes(a, b) +end diff --git a/src/ecc/ECC.jl b/src/ecc/ECC.jl index cdda7742e..269f352c2 100644 --- a/src/ecc/ECC.jl +++ b/src/ecc/ECC.jl @@ -22,6 +22,7 @@ export parity_checks, parity_checks_x, parity_checks_z, iscss, Shor9, Steane7, Cleve8, Perfect5, Bitflip3, Toric, Gottesman, Surface, Concat, CircuitCode, QuantumReedMuller, LPCode, two_block_group_algebra_codes, generalized_bicycle_codes, bicycle_codes, + Haah_cubic_codes, random_brickwork_circuit_code, random_all_to_all_circuit_code, evaluate_decoder, CommutationCheckECCSetup, NaiveSyndromeECCSetup, ShorSyndromeECCSetup, diff --git a/src/ecc/codes/lifted_product.jl b/src/ecc/codes/lifted_product.jl index 338880702..aa0a4fccb 100644 --- a/src/ecc/codes/lifted_product.jl +++ b/src/ecc/codes/lifted_product.jl @@ -17,3 +17,6 @@ function generalized_bicycle_codes end """Implemented in a package extension with Hecke.""" function bicycle_codes end + +"""Implemented in a package extension with Hecke.""" +function Haah_cubic_codes end diff --git a/test/test_ecc_base.jl b/test/test_ecc_base.jl index f087ea627..2255a8632 100644 --- a/test/test_ecc_base.jl +++ b/test/test_ecc_base.jl @@ -41,6 +41,10 @@ test_gb_codes = [ generalized_bicycle_codes([0, 1, 14, 16, 22], [0, 3, 13, 20, 42], 63), ] +test_hcubic_codes = [ + Haah_cubic_codes([0, 15, 20, 28, 66], [0, 58, 59, 100, 121], 3) +] + other_lifted_product_codes = [] # from Eq. (18) in Appendix A of [raveendran2022finite](@cite) @@ -63,7 +67,7 @@ const code_instance_args = Dict( :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)), + :LPCode => (c -> (c.A, c.B)).(vcat(LP04, LP118, test_gb_codes, test_hcubic_codes, other_lifted_product_codes)), :QuantumReedMuller => [3, 4, 5] ) From 7bbe689003b286d451c56a378e22664af6c6bb1d Mon Sep 17 00:00:00 2001 From: Feroz Ahmad Date: Tue, 5 Nov 2024 18:21:53 +0500 Subject: [PATCH 2/7] Update ext/QuantumCliffordHeckeExt/lifted_product.jl Co-authored-by: Stefan Krastanov --- ext/QuantumCliffordHeckeExt/lifted_product.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/QuantumCliffordHeckeExt/lifted_product.jl b/ext/QuantumCliffordHeckeExt/lifted_product.jl index 16566aa0c..9b4bc42b3 100644 --- a/ext/QuantumCliffordHeckeExt/lifted_product.jl +++ b/ext/QuantumCliffordHeckeExt/lifted_product.jl @@ -218,7 +218,7 @@ function bicycle_codes(a_shifts::Array{Int}, l::Int) end """ -Haah’s cubic codes [haah2011local](@cite) can be viewed as GB codes +Haah’s cubic codes [haah2011local](@cite) can be viewed as generalized bicycle (GB) codes with the group `G = Cₗ × Cₗ × Cₗ`, where `l` denotes the lattice size. In particular, a GB code with the group `G = ℤ₃ˣ³` corresponds to a cubic code [https://errorcorrectionzoo.org/c/haah_cubic](@cite). From 3c0a27e3d26cbd0629741385f12e948428167a1a Mon Sep 17 00:00:00 2001 From: Feroz Ahmad Date: Tue, 5 Nov 2024 18:21:59 +0500 Subject: [PATCH 3/7] Update ext/QuantumCliffordHeckeExt/lifted_product.jl Co-authored-by: Stefan Krastanov --- ext/QuantumCliffordHeckeExt/lifted_product.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/QuantumCliffordHeckeExt/lifted_product.jl b/ext/QuantumCliffordHeckeExt/lifted_product.jl index 9b4bc42b3..85e0c0334 100644 --- a/ext/QuantumCliffordHeckeExt/lifted_product.jl +++ b/ext/QuantumCliffordHeckeExt/lifted_product.jl @@ -230,7 +230,7 @@ julia> code_n(c), code_k(c) (432, 8) ``` """ -function Haah_cubic_codes(a_shifts::Array{Int}, b_shifts::Array{Int}, l::Int) +function haah_cubic_codes(a_shifts::Array{Int}, b_shifts::Array{Int}, l::Int) GA = group_algebra(GF(2), abelian_group([l,l,l])) a = sum(GA[n%dim(GA)+1] for n in a_shifts) b = sum(GA[n%dim(GA)+1] for n in b_shifts) From c376d109d23198200d462fab3274c8a33a6092a8 Mon Sep 17 00:00:00 2001 From: Fe-r-oz Date: Tue, 5 Nov 2024 18:32:17 +0500 Subject: [PATCH 4/7] add see also --- ext/QuantumCliffordHeckeExt/lifted_product.jl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ext/QuantumCliffordHeckeExt/lifted_product.jl b/ext/QuantumCliffordHeckeExt/lifted_product.jl index 3de6ec947..05293333c 100644 --- a/ext/QuantumCliffordHeckeExt/lifted_product.jl +++ b/ext/QuantumCliffordHeckeExt/lifted_product.jl @@ -77,7 +77,8 @@ The default representation, provided by `Hecke`, is the permutation representati We also accept a custom representation function as detailed in [`LiftedCode`](@ref). -See also: [`LiftedCode`](@ref), [`two_block_group_algebra_codes`](@ref), [`generalized_bicycle_codes`](@ref), [`bicycle_codes`](@ref). +See also: [`LiftedCode`](@ref), [`two_block_group_algebra_codes`](@ref), [`generalized_bicycle_codes`](@ref), [`bicycle_codes`](@ref), +[`haah_cubic_codes`](@ref). $TYPEDFIELDS """ @@ -251,12 +252,10 @@ julia> 𝜋 = gens(GA)[1]; julia> A = 𝜋^2 + 𝜋^5 + 𝜋^44; julia> B = 𝜋^8 + 𝜋^14 + 𝜋^47; - - (108, 12) ``` -See also: [`LPCode`](@ref), [`generalized_bicycle_codes`](@ref), [`bicycle_codes`](@ref). +See also: [`LPCode`](@ref), [`generalized_bicycle_codes`](@ref), [`bicycle_codes`](@ref), [`haah_cubic_codes`](@ref). """ function two_block_group_algebra_codes(a::GroupAlgebraElem, b::GroupAlgebraElem) LPCode([a;;], [b;;]) @@ -302,7 +301,7 @@ Bicycle codes are a special case of generalized bicycle codes, where `a` and `b` are conjugate to each other. The order of the cyclic group is `l`, and the shifts `a_shifts` and `b_shifts` are reverse to each other. -See also: [`two_block_group_algebra_codes`](@ref), [`generalized_bicycle_codes`](@ref). +See also: [`two_block_group_algebra_codes`](@ref), [`generalized_bicycle_codes`](@ref), [`haah_cubic_codes`](@ref). """ # TODO doctest example function bicycle_codes(a_shifts::Array{Int}, l::Int) GA = group_algebra(GF(2), abelian_group(l)) @@ -322,6 +321,8 @@ julia> c = Haah_cubic_codes([0, 15, 20, 28, 66], [0, 58, 59, 100, 121], 6); julia> code_n(c), code_k(c) (432, 8) ``` + +See also: [`bicycle_codes`](@ref), [`generalized_bicycle_codes`](@ref), [`two_block_group_algebra_codes`](@ref). """ function haah_cubic_codes(a_shifts::Array{Int}, b_shifts::Array{Int}, l::Int) GA = group_algebra(GF(2), abelian_group([l,l,l])) From 5164e2f5128a176b15781008f2acc3f90db0748c Mon Sep 17 00:00:00 2001 From: Fe-r-oz Date: Tue, 5 Nov 2024 20:38:11 +0500 Subject: [PATCH 5/7] remove the old capitalization of first letter --- ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl | 2 +- src/ecc/ECC.jl | 2 +- src/ecc/codes/lifted_product.jl | 2 +- test/test_ecc_base.jl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl b/ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl index cf4886875..89d7bae0c 100644 --- a/ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl +++ b/ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl @@ -12,7 +12,7 @@ import Nemo: characteristic, matrix_repr, GF, ZZ, lift import QuantumClifford.ECC: AbstractECC, CSS, ClassicalCode, hgp, code_k, code_n, code_s, iscss, parity_checks, parity_checks_x, parity_checks_z, parity_checks_xz, two_block_group_algebra_codes, generalized_bicycle_codes, bicycle_codes, check_repr_commutation_relation, - Haah_cubic_codes + haah_cubic_codes include("util.jl") include("types.jl") diff --git a/src/ecc/ECC.jl b/src/ecc/ECC.jl index f9e8c2fc3..231816318 100644 --- a/src/ecc/ECC.jl +++ b/src/ecc/ECC.jl @@ -29,7 +29,7 @@ export parity_checks, parity_checks_x, parity_checks_z, iscss, Shor9, Steane7, Cleve8, Perfect5, Bitflip3, Toric, Gottesman, Surface, Concat, CircuitCode, QuantumReedMuller, LPCode, two_block_group_algebra_codes, generalized_bicycle_codes, bicycle_codes, - Haah_cubic_codes, + haah_cubic_codes, random_brickwork_circuit_code, random_all_to_all_circuit_code, evaluate_decoder, CommutationCheckECCSetup, NaiveSyndromeECCSetup, ShorSyndromeECCSetup, diff --git a/src/ecc/codes/lifted_product.jl b/src/ecc/codes/lifted_product.jl index aa0a4fccb..2a0c2c36f 100644 --- a/src/ecc/codes/lifted_product.jl +++ b/src/ecc/codes/lifted_product.jl @@ -19,4 +19,4 @@ function generalized_bicycle_codes end function bicycle_codes end """Implemented in a package extension with Hecke.""" -function Haah_cubic_codes end +function haah_cubic_codes end diff --git a/test/test_ecc_base.jl b/test/test_ecc_base.jl index e85596835..7c1d12ef5 100644 --- a/test/test_ecc_base.jl +++ b/test/test_ecc_base.jl @@ -43,7 +43,7 @@ test_gb_codes = [ ] test_hcubic_codes = [ - Haah_cubic_codes([0, 15, 20, 28, 66], [0, 58, 59, 100, 121], 3) + haah_cubic_codes([0, 15, 20, 28, 66], [0, 58, 59, 100, 121], 3) ] other_lifted_product_codes = [] From dd22a7f6d10f1756afece6f9615d4c5c22a774ee Mon Sep 17 00:00:00 2001 From: Fe-r-oz Date: Tue, 5 Nov 2024 20:42:57 +0500 Subject: [PATCH 6/7] add ECC Zoo entry --- ext/QuantumCliffordHeckeExt/lifted_product.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ext/QuantumCliffordHeckeExt/lifted_product.jl b/ext/QuantumCliffordHeckeExt/lifted_product.jl index 05293333c..473f308e1 100644 --- a/ext/QuantumCliffordHeckeExt/lifted_product.jl +++ b/ext/QuantumCliffordHeckeExt/lifted_product.jl @@ -311,9 +311,10 @@ end """ Haah’s cubic codes [haah2011local](@cite) can be viewed as generalized bicycle (GB) codes -with the group `G = Cₗ × Cₗ × Cₗ`, where `l` denotes the lattice size. -In particular, a GB code with the group `G = ℤ₃ˣ³` corresponds to a -cubic code [https://errorcorrectionzoo.org/c/haah_cubic](@cite). +with the group `G = Cₗ × Cₗ × Cₗ`, where `l` denotes the lattice size. In particular, a GB +code with the group `G = ℤ₃ˣ³` corresponds to a cubic code. + +The ECC Zoo has an [entry for this family](https://errorcorrectionzoo.org/c/haah_cubic). ```jldoctest julia> c = Haah_cubic_codes([0, 15, 20, 28, 66], [0, 58, 59, 100, 121], 6); From c96731fba28014e7eee9ffa96f81e81d7e377b04 Mon Sep 17 00:00:00 2001 From: Stefan Krastanov Date: Tue, 5 Nov 2024 11:41:13 -0500 Subject: [PATCH 7/7] Update ext/QuantumCliffordHeckeExt/lifted_product.jl --- ext/QuantumCliffordHeckeExt/lifted_product.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/QuantumCliffordHeckeExt/lifted_product.jl b/ext/QuantumCliffordHeckeExt/lifted_product.jl index 473f308e1..66bd35ed6 100644 --- a/ext/QuantumCliffordHeckeExt/lifted_product.jl +++ b/ext/QuantumCliffordHeckeExt/lifted_product.jl @@ -317,7 +317,7 @@ code with the group `G = ℤ₃ˣ³` corresponds to a cubic code. The ECC Zoo has an [entry for this family](https://errorcorrectionzoo.org/c/haah_cubic). ```jldoctest -julia> c = Haah_cubic_codes([0, 15, 20, 28, 66], [0, 58, 59, 100, 121], 6); +julia> c = haah_cubic_codes([0, 15, 20, 28, 66], [0, 58, 59, 100, 121], 6); julia> code_n(c), code_k(c) (432, 8)