Skip to content

Commit

Permalink
improve code quality by removing redundancy
Browse files Browse the repository at this point in the history
  • Loading branch information
Fe-r-oz committed Oct 19, 2024
1 parent ae51ea2 commit a43e5ff
Showing 1 changed file with 26 additions and 46 deletions.
72 changes: 26 additions & 46 deletions test/test_ecc_nonabelin2bga.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
@testitem "ECC 2BGA lin2024quantum" begin
import Hecke: group_algebra, GF, abelian_group, gens, quo, one
@testitem "ECC 2BGA abelian and non-abelian groups via group presentation" begin
using Nemo: FqFieldElem
using Hecke: group_algebra, GF, abelian_group, gens, quo, one, GroupAlgebra
using QuantumClifford.ECC
using QuantumClifford.ECC: LPCode, code_k, code_n, two_block_group_algebra_codes
using Oscar: free_group, small_group_identification, describe
using QuantumClifford.ECC: code_k, code_n, two_block_group_algebra_codes
using Oscar: free_group, small_group_identification, describe, order, FPGroupElem, FPGroup, FPGroupElem

function get_code(a_elts::Vector{FPGroupElem}, b_elts::Vector{FPGroupElem}, F2G::GroupAlgebra{FqFieldElem, FPGroup, FPGroupElem})
a = sum(F2G(x) for x in a_elts)
b = sum(F2G(x) for x in b_elts)
c = two_block_group_algebra_codes(a,b)
return c
end

@testset "Reproduce Table 1 Block 1" begin
# [[72, 8, 9]]
Expand All @@ -13,9 +21,7 @@
r = gens(G)[1]
a_elts = [one(G), r^28]
b_elts = [one(G), r, r^18, r^12, r^29, r^14]
a = sum(F2G(x) for x in a_elts)
b = sum(F2G(x) for x in b_elts)
c = two_block_group_algebra_codes(a, b)
c = get_code(a_elts, b_elts, F2G)
@test describe(G) == "C36"
@test small_group_identification(G) == (36, 2)
@test code_n(c) == 72 && code_k(c) == 8
Expand All @@ -30,9 +36,7 @@
r, s = gens(G)
a_elts = [one(G), r]
b_elts = [one(G), s, r^6, s^3 * r, s * r^7, s^3 * r^5]
a = sum(F2G(x) for x in a_elts)
b = sum(F2G(x) for x in b_elts)
c = two_block_group_algebra_codes(a, b)
c = get_code(a_elts, b_elts, F2G)
@test describe(G) == "C9 : C4"
@test small_group_identification(G) == (36, 1)
@test code_n(c) == 72 && code_k(c) == 8
Expand All @@ -45,9 +49,7 @@
r, s = gens(G)
a_elts = [one(G), s*r^4]
b_elts = [one(G), r, r^2, s, s^3 * r, s^2 * r^6]
a = sum(F2G(x) for x in a_elts)
b = sum(F2G(x) for x in b_elts)
c = two_block_group_algebra_codes(a, b)
c = get_code(a_elts, b_elts, F2G)
@test describe(G) == "C5 : C8"
@test small_group_identification(G) == (40, 1)
@test code_n(c) == 80 && code_k(c) == 8
Expand All @@ -62,9 +64,7 @@
r = gens(G)[1]
a_elts = [one(G), r, r^3, r^7]
b_elts = [one(G), r, r^12, r^19]
a = sum(F2G(x) for x in a_elts);
b = sum(F2G(x) for x in b_elts)
c = two_block_group_algebra_codes(a, b)
c = get_code(a_elts, b_elts, F2G)
@test describe(G) == "C27"
@test small_group_identification(G) == (27, 1)
@test code_n(c) == 54 && code_k(c) == 6
Expand All @@ -77,9 +77,7 @@
r = gens(G)[1]
a_elts = [one(G), r^10, r^6, r^13]
b_elts = [one(G), r^25, r^16, r^12]
a = sum(F2G(x) for x in a_elts);
b = sum(F2G(x) for x in b_elts)
c = two_block_group_algebra_codes(a, b)
c = get_code(a_elts, b_elts, F2G)
@test describe(G) == "C30"
@test small_group_identification(G) == (30, 4)
@test code_n(c) == 60 && code_k(c) == 6
Expand All @@ -92,9 +90,7 @@
r = gens(G)[1]
a_elts = [one(G), r^15, r^16, r^18]
b_elts = [one(G), r, r^24, r^27]
a = sum(F2G(x) for x in a_elts);
b = sum(F2G(x) for x in b_elts)
c = two_block_group_algebra_codes(a, b)
c = get_code(a_elts, b_elts, F2G)
@test describe(G) == "C35"
@test small_group_identification(G) == (35, 1)
@test code_n(c) == 70 && code_k(c) == 8
Expand All @@ -107,9 +103,7 @@
r = gens(G)[1]
a_elts = [one(G), r^9, r^28, r^31]
b_elts = [one(G), r, r^21, r^34]
a = sum(F2G(x) for x in a_elts);
b = sum(F2G(x) for x in b_elts)
c = two_block_group_algebra_codes(a, b)
c = get_code(a_elts, b_elts, F2G)
@test describe(G) == "C36"
@test small_group_identification(G) == (36, 2)
@test code_n(c) == 72 && code_k(c) == 8
Expand All @@ -122,9 +116,7 @@
r = gens(G)[1]
a_elts = [one(G), r^9, r^28, r^13]
b_elts = [one(G), r, r^3, r^22]
a = sum(F2G(x) for x in a_elts);
b = sum(F2G(x) for x in b_elts)
c = two_block_group_algebra_codes(a, b)
c = get_code(a_elts, b_elts, F2G)
@test describe(G) == "C36"
@test small_group_identification(G) == (36, 2)
@test code_n(c) == 72 && code_k(c) == 10
Expand All @@ -139,9 +131,7 @@
r, s = gens(G)
a_elts = [one(G), s, r, s*r^6]
b_elts = [one(G), s^2*r, s^2*r^6, r^2]
a = sum(F2G(x) for x in a_elts);
b = sum(F2G(x) for x in b_elts)
c = two_block_group_algebra_codes(a, b)
c = get_code(a_elts, b_elts, F2G)
@test describe(G) == "C9 : C4"
@test small_group_identification(G) == (36, 1)
@test code_n(c) == 72 && code_k(c) == 8
Expand All @@ -154,9 +144,7 @@
r, s = gens(G)
a_elts = [one(G), r, s, s^3*r^5]
b_elts = [one(G), r^2, s*r^4, s^3*r^2]
a = sum(F2G(x) for x in a_elts)
b = sum(F2G(x) for x in b_elts)
c = two_block_group_algebra_codes(a, b)
c = get_code(a_elts, b_elts, F2G)
@test describe(G) == "C5 : C8"
@test small_group_identification(G) == (40, 1)
@test code_n(c) == 80 && code_k(c) == 8
Expand All @@ -169,9 +157,7 @@
r, s = gens(G)
a_elts = [one(G), r, s, r^14]
b_elts = [one(G), r^2, s*r^4, r^11]
a = sum(F2G(x) for x in a_elts)
b = sum(F2G(x) for x in b_elts)
c = two_block_group_algebra_codes(a, b)
c = get_code(a_elts, b_elts, F2G)
@test describe(G) == "C3 : C16"
@test small_group_identification(G) == (48, 1)
@test code_n(c) == 96 && code_k(c) == 6
Expand All @@ -184,9 +170,7 @@
r, s = gens(G)
a_elts = [one(G), r^7, r^8, s*r^10]
b_elts = [one(G), s, r^5, s^2*r^13]
a = sum(F2G(x) for x in a_elts)
b = sum(F2G(x) for x in b_elts)
c = two_block_group_algebra_codes(a, b)
c = get_code(a_elts, b_elts, F2G)
@test describe(G) == "C7 x S3"
@test small_group_identification(G) == (42, 3)
@test code_n(c) == 84 && code_k(c) == 10
Expand All @@ -199,9 +183,7 @@
r, s = gens(G)
a_elts = [one(G), s, r^9, s * r]
b_elts = [one(G), s^2 * s^9, r^7, r^2]
a = sum(F2G(x) for x in a_elts);
b = sum(F2G(x) for x in b_elts)
c = two_block_group_algebra_codes(a, b)
c = get_code(a_elts, b_elts, F2G)
@test describe(G) == "C12 : C4"
@test small_group_identification(G) == (48, 13)
@test code_n(c) == 96 && code_k(c) == 6
Expand All @@ -214,9 +196,7 @@
r, s = gens(G)
a_elts = [one(G), r, s^3 * r^2, s^2 * r^3]
b_elts = [one(G), r, s^4 * r^6, s^5 * r^3]
a = sum(F2G(x) for x in a_elts)
b = sum(F2G(x) for x in b_elts)
c = two_block_group_algebra_codes(a, b)
c = get_code(a_elts, b_elts, F2G)
@test describe(G) == "C2 x (C3 : C8)"
@test small_group_identification(G) == (48, 9)
@test code_n(c) == 96 && code_k(c) == 12
Expand Down

0 comments on commit a43e5ff

Please sign in to comment.