From 27d98978882c5a67e42a8714f8dccd406610ad3e Mon Sep 17 00:00:00 2001 From: Fe-r-oz Date: Tue, 5 Nov 2024 10:49:24 +0500 Subject: [PATCH] add wonderful codereview suggestion --- docs/src/references.bib | 21 ++-- docs/src/references.md | 2 + .../QuantumCliffordHeckeExt.jl | 3 +- ext/QuantumCliffordHeckeExt/lifted_product.jl | 12 +- ext/QuantumCliffordHeckeExt/types.jl | 4 - test/test_ecc_base.jl | 20 ++-- test/test_ecc_bivaraite_bicycle_as_twobga.jl | 108 +++++++++--------- 7 files changed, 83 insertions(+), 87 deletions(-) diff --git a/docs/src/references.bib b/docs/src/references.bib index e1a3c9521..635ca65ee 100644 --- a/docs/src/references.bib +++ b/docs/src/references.bib @@ -513,16 +513,6 @@ @article{anderson2014fault publisher={APS} } -@article{bravyi2024high, - title={High-threshold and low-overhead fault-tolerant quantum memory}, - author={Bravyi, Sergey and Cross, Andrew W and Gambetta, Jay M and Maslov, Dmitri and Rall, Patrick and Yoder, Theodore J}, - journal={Nature}, - volume={627}, - number={8005}, - pages={778--782}, - year={2024}, - publisher={Nature Publishing Group UK London} - @article{lin2024quantum, title={Quantum two-block group algebra codes}, author={Lin, Hsiang-Ku and Pryadko, Leonid P}, @@ -533,3 +523,14 @@ @article{lin2024quantum year={2024}, publisher={APS} } + +@article{bravyi2024high, + title={High-threshold and low-overhead fault-tolerant quantum memory}, + author={Bravyi, Sergey and Cross, Andrew W and Gambetta, Jay M and Maslov, Dmitri and Rall, Patrick and Yoder, Theodore J}, + journal={Nature}, + volume={627}, + number={8005}, + pages={778--782}, + year={2024}, + publisher={Nature Publishing Group UK London} +} diff --git a/docs/src/references.md b/docs/src/references.md index 35e944a21..049f222b5 100644 --- a/docs/src/references.md +++ b/docs/src/references.md @@ -40,6 +40,8 @@ For quantum code construction routines: - [steane1999quantum](@cite) - [campbell2012magic](@cite) - [anderson2014fault](@cite) +- [lin2024quantum](@cite) +- [bravyi2024high](@cite) For classical code construction routines: - [muller1954application](@cite) diff --git a/ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl b/ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl index d6157d1fc..da7188fcb 100644 --- a/ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl +++ b/ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl @@ -5,8 +5,7 @@ using DocStringExtensions import QuantumClifford, LinearAlgebra import Hecke: Group, GroupElem, AdditiveGroup, AdditiveGroupElem, GroupAlgebra, GroupAlgebraElem, FqFieldElem, representation_matrix, dim, base_ring, - multiplication_table, coefficients, abelian_group, group_algebra, rand, - FinGenAbGroup, FinGenAbGroupElem, one + multiplication_table, coefficients, abelian_group, group_algebra, rand, one import Nemo import Nemo: characteristic, matrix_repr, GF, ZZ, lift diff --git a/ext/QuantumCliffordHeckeExt/lifted_product.jl b/ext/QuantumCliffordHeckeExt/lifted_product.jl index 807e4f9a8..9851d7585 100644 --- a/ext/QuantumCliffordHeckeExt/lifted_product.jl +++ b/ext/QuantumCliffordHeckeExt/lifted_product.jl @@ -238,19 +238,17 @@ julia> GA = group_algebra(GF(2), abelian_group([l, m])); julia> x, y = gens(GA); -julia> A = [x^3 , y^10 , y^17]; +julia> A = x^3 + y^10 + y^17; -julia> B = [y^5 , x^3 , x^19]; +julia> B = y^5 + x^3 + x^19; -julia> c = bivariate_bicycle_codes(A,B,GA); +julia> c = bivariate_bicycle_codes(A,B); julia> code_n(c), code_k(c) (756, 16) ``` """ -function bivariate_bicycle_codes(A::VectorGroupAlgebraElem, B::VectorGroupAlgebraElem, GA::FqFieldFinGenAbGroupElemGroupAlgebra) - a = sum(GA(x) for x in A) - b = sum(GA(x) for x in B) - c = two_block_group_algebra_codes(a,b) +function bivariate_bicycle_codes(A::GroupAlgebraElem, B::GroupAlgebraElem) + c = two_block_group_algebra_codes(A,B) return c end diff --git a/ext/QuantumCliffordHeckeExt/types.jl b/ext/QuantumCliffordHeckeExt/types.jl index 6c22c8935..ecd0d7a68 100644 --- a/ext/QuantumCliffordHeckeExt/types.jl +++ b/ext/QuantumCliffordHeckeExt/types.jl @@ -10,10 +10,6 @@ const FqFieldGroupAlgebraElemMatrix = Union{ LinearAlgebra.Adjoint{<:GroupAlgebraElem{FqFieldElem,<:GroupAlgebra},<:Matrix{<:GroupAlgebraElem{FqFieldElem,<:GroupAlgebra}}} } -const VectorGroupAlgebraElem = Vector{GroupAlgebraElem{FqFieldElem, GroupAlgebra{FqFieldElem, FinGenAbGroup, FinGenAbGroupElem}}} - -const FqFieldFinGenAbGroupElemGroupAlgebra = GroupAlgebra{FqFieldElem, FinGenAbGroup, FinGenAbGroupElem} - """ Compute the conjugate of a group algebra element. The conjugate is defined by inversing elements in the associated group. diff --git a/test/test_ecc_base.jl b/test/test_ecc_base.jl index 1884f4ce8..bfa759fe7 100644 --- a/test/test_ecc_base.jl +++ b/test/test_ecc_base.jl @@ -6,7 +6,7 @@ using InteractiveUtils import Nemo: GF import LinearAlgebra -import Hecke: group_algebra, abelian_group, gens, one +import Hecke: group_algebra, abelian_group, gens # generate instances of all implemented codes to make sure nothing skips being checked @@ -62,25 +62,25 @@ push!(other_lifted_product_codes, LPCode(A, B)) l=6; m=6 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) -A = [x^3, y, y^2] -B = [y^3, x, x^2] -bb1 = bivariate_bicycle_codes(A,B,GA) +A = x^3 + y + y^2 +B = y^3 + x + x^2 +bb1 = bivariate_bicycle_codes(A,B) # A [[90, 8, 10]] code from Table 3 of [bravyi2024high](@cite). l=15; m=3 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) -A = [x^9 , y , y^2] -B = [one(x), x^2 , x^7] -bb2 = bivariate_bicycle_codes(A,B,GA) +A = x^9 + y + y^2 +B = 1 + x^2 + x^7 +bb2 = bivariate_bicycle_codes(A,B) # A [[360, 12, ≤ 24]] code from Table 3 of [bravyi2024high](@cite). l=30; m=6 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) -A = [x^9 , y , y^2] -B = [y^3 , x^25 , x^26] -bb3 = bivariate_bicycle_codes(A,B,GA) +A = x^9 + y + y^2 +B = y^3 + x^25 + x^26 +bb3 = bivariate_bicycle_codes(A,B) test_bb_codes = [bb1, bb2, bb3] diff --git a/test/test_ecc_bivaraite_bicycle_as_twobga.jl b/test/test_ecc_bivaraite_bicycle_as_twobga.jl index cee31f642..670533b9e 100644 --- a/test/test_ecc_bivaraite_bicycle_as_twobga.jl +++ b/test/test_ecc_bivaraite_bicycle_as_twobga.jl @@ -8,63 +8,63 @@ l=6; m=6 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) - A = [x^3, y, y^2] - B = [y^3, x, x^2] - c = bivariate_bicycle_codes(A,B,GA) + A = x^3 + y + y^2 + B = y^3 + x + x^2 + c = bivariate_bicycle_codes(A,B) @test code_n(c) == 72 && code_k(c) == 12 # [[90, 8, 10]] l=15; m=3 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) - A = [x^9 , y , y^2] - B = [one(x), x^2 , x^7] - c = bivariate_bicycle_codes(A,B,GA) + A = x^9 + y + y^2 + B = 1 + x^2 + x^7 + c = bivariate_bicycle_codes(A,B) @test code_n(c) == 90 && code_k(c) == 8 # [[108, 8, 10]] l=9; m=6 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) - A = [x^3 , y , y^2] - B = [y^3 , x , x^2] - c = bivariate_bicycle_codes(A,B,GA) + A = x^3 + y + y^2 + B = y^3 + x + x^2 + c = bivariate_bicycle_codes(A,B) @test code_n(c) == 108 && code_k(c) == 8 # [[144, 12, 12]] l=12; m=6 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) - A = [x^3 , y , y^2] - B = [y^3 , x , x^2] - c = bivariate_bicycle_codes(A,B,GA) + A = x^3 + y + y^2 + B = y^3 + x + x^2 + c = bivariate_bicycle_codes(A,B) @test code_n(c) == 144 && code_k(c) == 12 # [[288, 12, 12]] l=12; m=12 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) - A = [x^3 , y^2, y^7] - B = [y^3 , x , x^2] - c = bivariate_bicycle_codes(A,B,GA) + A = x^3 + y^2 + y^7 + B = y^3 + x + x^2 + c = bivariate_bicycle_codes(A,B) @test code_n(c) == 288 && code_k(c) == 12 # [[360, 12, ≤ 24]] l=30; m=6 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) - A = [x^9 , y , y^2] - B = [y^3 , x^25 , x^26] - c = bivariate_bicycle_codes(A,B,GA) + A = x^9 + y + y^2 + B = y^3 + x^25 + x^26 + c = bivariate_bicycle_codes(A,B) @test code_n(c) == 360 && code_k(c) == 12 # [[756, 16, ≤ 34]] l=21; m=18 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) - A = [x^3 , y^10 , y^17] - B = [y^5 , x^3 , x^19] - c = bivariate_bicycle_codes(A,B,GA) + A = x^3 + y^10 + y^17 + B = y^5 + x^3 + x^19 + c = bivariate_bicycle_codes(A,B) @test code_n(c) == 756 && code_k(c) == 16 end @@ -73,45 +73,45 @@ l=12; m=3 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) - A = [x^9 , y , y^2] - B = [one(x), x , x^11] - c = bivariate_bicycle_codes(A,B,GA) + A = x^9 + y + y^2 + B = 1 + x + x^11 + c = bivariate_bicycle_codes(A,B) @test code_n(c) == 72 && code_k(c) == 8 # [[90, 8, 6]] l=9; m=5 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) - A = [x^8 , y^4 , y] - B = [y^5 , x^8 , x^7] - c = bivariate_bicycle_codes(A,B,GA) + A = x^8 + y^4 + y + B = y^5 + x^8 + x^7 + c = bivariate_bicycle_codes(A,B) @test code_n(c) == 90 && code_k(c) == 8 # [[120, 8, 8]] l=12; m=5 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) - A = [x^10 , y^4, y] - B = [one(x), x , x^2] - c = bivariate_bicycle_codes(A,B,GA) + A = x^10 + y^4 + y + B = 1 + x + x^2 + c = bivariate_bicycle_codes(A,B) @test code_n(c) == 120 && code_k(c) == 8 # [[150, 8, 8]] l=15; m=5 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) - A = [x^5 , y^2 , y^3] - B = [y^2 , x^7 , x^6] - c = bivariate_bicycle_codes(A,B,GA) + A = x^5 + y^2 + y^3 + B = y^2 + x^7 + x^6 + c = bivariate_bicycle_codes(A,B) @test code_n(c) == 150 && code_k(c) == 8 # [[196, 12, 8]] l=14; m=7 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) - A = [x^6 , y^5 , y^6] - B = [one(x), x^4 , x^13] - c = bivariate_bicycle_codes(A,B,GA) + A = x^6 + y^5 + y^6 + B = 1 + x^4 + x^13 + c = bivariate_bicycle_codes(A,B) @test code_n(c) == 196 && code_k(c) == 12 end @@ -120,54 +120,54 @@ l=3; m=9 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) - A = [one(x), y^2, y^4] - B = [y^3 , x , x^2] - c = bivariate_bicycle_codes(A,B,GA) + A = 1 + y^2 + y^4 + B = y^3 + x + x^2 + c = bivariate_bicycle_codes(A,B) @test code_n(c) == 54 && code_k(c) == 8 # [[98, 6, 12]] l=7; m=7 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) - A = [x^3 , y^5 , y^6] - B = [y^2 , x^3 , x^5] - c = bivariate_bicycle_codes(A,B,GA) + A = x^3 + y^5 + y^6 + B = y^2 + x^3 + x^5 + c = bivariate_bicycle_codes(A,B) @test code_n(c) == 98 && code_k(c) == 6 # [[126, 8, 10]] l=3; m=21 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) - A = [one(x), y^2, y^10] - B = [y^3 , x , x^2] - c = bivariate_bicycle_codes(A,B,GA) + A = 1 + y^2 + y^10 + B = y^3 + x + x^2 + c = bivariate_bicycle_codes(A,B) @test code_n(c) == 126 && code_k(c) == 8 # [[150, 16, 8]] l=5; m=15 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) - A = [one(x), y^6, y^8] - B = [y^5 , x , x^4] - c = bivariate_bicycle_codes(A,B,GA) + A = 1 + y^6 + y^8 + B = y^5 + x + x^4 + c = bivariate_bicycle_codes(A,B) @test code_n(c) == 150 && code_k(c) == 16 # [[162, 8, 14]] l=3; m=27 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) - A = [one(x), y^10, y^14] - B = [y^12 , x , x^2] - c = bivariate_bicycle_codes(A,B,GA) + A = 1 + y^10 + y^14 + B = y^12 + x + x^2 + c = bivariate_bicycle_codes(A,B) @test code_n(c) == 162 && code_k(c) == 8 # [[180, 8, 16]] l=6; m=15 GA = group_algebra(GF(2), abelian_group([l, m])) x, y = gens(GA) - A = [x^3 , y , y^2] - B = [y^6 , x^4 , x^5] - c = bivariate_bicycle_codes(A,B,GA) + A = x^3 + y + y^2 + B = y^6 + x^4 + x^5 + c = bivariate_bicycle_codes(A,B) @test code_n(c) == 180 && code_k(c) == 8 end end