Skip to content

Commit

Permalink
tests: Semidirect Product of Two Cyclic Groups to form Dihedral Group
Browse files Browse the repository at this point in the history
  • Loading branch information
Fe-r-oz committed Oct 24, 2024
1 parent 6a8dbb4 commit 60ce559
Show file tree
Hide file tree
Showing 2 changed files with 239 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ LDPCDecoders = "3c486d74-64b9-4c60-8b1a-13a564e77efb"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
Nemo = "2edaba10-b0f1-5616-af89-8c11ac63239a"
Oscar = "f1435218-dba5-11e9-1e4d-f1a5fab5fc13"
PyQDecoders = "17f5de1a-9b79-4409-a58d-4d45812840f7"
Quantikz = "b0d11df0-eea3-4d79-b4a5-421488cbf74b"
QuantumInterface = "5717a53b-5d69-4fa3-b976-0bf2f97ca1e5"
Expand Down
238 changes: 238 additions & 0 deletions test/test_ecc_dihedral_semidirect_products.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
@testitem "ECC Dihedral group via semidirect_product" begin
using Nemo: FqFieldElem
using Hecke: group_algebra, GF, abelian_group, gens, quo, one, GroupAlgebra, GroupAlgebraElem
using QuantumClifford.ECC
using QuantumClifford.ECC: code_k, code_n, two_block_group_algebra_codes
using Oscar: small_group_identification, describe, order, FPGroupElem, FPGroup, FPGroupElem, semidirect_product, automorphism_group, hom, gen, cyclic_group, SemidirectProductGroup, PcGroup, BasicGAPGroupElem, normal_subgroup

Check warning on line 6 in test/test_ecc_dihedral_semidirect_products.jl

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"hom" should be "home".

function get_code(a_elts::Vector{GroupAlgebraElem{FqFieldElem, GroupAlgebra{FqFieldElem, SemidirectProductGroup{PcGroup, PcGroup}, BasicGAPGroupElem{SemidirectProductGroup{PcGroup, PcGroup}}}}}, b_elts::Vector{GroupAlgebraElem{FqFieldElem, GroupAlgebra{FqFieldElem, SemidirectProductGroup{PcGroup, PcGroup}, BasicGAPGroupElem{SemidirectProductGroup{PcGroup, PcGroup}}}}}, GA::GroupAlgebra{FqFieldElem, SemidirectProductGroup{PcGroup, PcGroup}, BasicGAPGroupElem{SemidirectProductGroup{PcGroup, PcGroup}}})
a = sum(GA(x) for x in a_elts)
b = sum(GA(x) for x in b_elts)
c = two_block_group_algebra_codes(a,b)
return c
end

function semidirectproduct(m::Int)
Cₘ = cyclic_group(m)
C₂ = cyclic_group(2)
A = automorphism_group(Cₘ)
# Given specific Dihedral group presentation, choose r -> r⁻¹
au = A(hom(Cₘ,Cₘ,[Cₘ[1]],[Cₘ[1]^-1]))

Check warning on line 20 in test/test_ecc_dihedral_semidirect_products.jl

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"hom" should be "home".
f = hom(C₂,A,[C₂[1]],[au])

Check warning on line 21 in test/test_ecc_dihedral_semidirect_products.jl

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"hom" should be "home".
G = semidirect_product(Cₘ,f,C₂)
s = gen(G, 1)
r = gen(G, 2)
@test r^m == s^2 == (r*s)^2
GA = group_algebra(GF(2), G)
r, s = gens(GA)[2], gens(GA)[3];
return r, s, GA, G
end

@testset "Reproduce Table 3 of lin2024quantum" begin
# [[24, 8, 3]]
m = 6
r, s, GA, G = semidirectproduct(m)
a_elts = [one(r), r^4]
b_elts = [one(r), s*r^4, r^3, r^4, s*r^2, r]
c = get_code(a_elts, b_elts, GA)
@test order(G) == 2*m
@test describe(G) == "D$(m*2)"
@test describe(normal_subgroup(G)) == "C$m"
@test code_n(c) == 24 && code_k(c) == 8
@test small_group_identification(G) == (12, 4)

# [[24, 12, 2]]
r, s, GA, G = semidirectproduct(m)
a_elts = [one(r), r^3]
b_elts = [one(r), s*r, r^3, r^4, s*r^4, r]
c = get_code(a_elts, b_elts, GA)
@test order(G) == 2*m
@test describe(G) == "D$(m*2)"
@test code_n(c) == 24 && code_k(c) == 12
@test describe(normal_subgroup(G)) == "C$m"
@test small_group_identification(G) == (12, 4)

# [[32, 8, 4]]
m = 8
r, s, GA, G = semidirectproduct(m)
a_elts = [one(r), r^2]
b_elts = [one(r), s*r^5, s*r^4, r^2, s*r^7, s*r^6]
c = get_code(a_elts, b_elts, GA)
@test order(G) == 2*m
@test describe(G) == "D$(m*2)"
@test code_n(c) == 32 && code_k(c) == 8
@test describe(normal_subgroup(G)) == "C$m"
@test small_group_identification(G) == (16, 7)

# [[32, 16, 2]]
r, s, GA, G = semidirectproduct(m)
a_elts = [one(r), r^4]
b_elts = [one(r), s*r^3, s*r^6, r^4, s*r^7, s*r^2]
c = get_code(a_elts, b_elts, GA)
@test order(G) == 2*m
@test describe(G) == "D$(m*2)"
@test code_n(c) == 32 && code_k(c) == 16
@test describe(normal_subgroup(G)) == "C$m"
@test small_group_identification(G) == (16, 7)

# [[36, 12, 3]]
m = 9
r, s, GA, G = semidirectproduct(m)
a_elts = [one(r), r^3]
b_elts = [one(r), s, r, r^3, s*r^3, r^4]
c = get_code(a_elts, b_elts, GA)
@test order(G) == 2*m
@test describe(G) == "D$(m*2)"
@test code_n(c) == 36 && code_k(c) == 12
@test describe(normal_subgroup(G)) == "C$m"
@test small_group_identification(G) == (18, 1)

# [[40, 8, 5]]
m = 10
r, s, GA, G = semidirectproduct(m)
a_elts = [one(r), r^2]
b_elts = [one(r), s*r^4, r^5, r^2, s*r^6, r]
c = get_code(a_elts, b_elts, GA)
@test order(G) == 2*m
@test describe(G) == "D$(m*2)"
@test code_n(c) == 40 && code_k(c) == 8
@test describe(normal_subgroup(G)) == "C$m"
@test small_group_identification(G) == (20, 4)

# [[40, 20, 2]]
r, s, GA, G = semidirectproduct(m)
a_elts = [one(r), r^5]
b_elts = [one(r), s*r^2, r^5, r^6, s*r^7, r]
c = get_code(a_elts, b_elts, GA)
@test order(G) == 2*m
@test describe(G) == "D$(m*2)"
@test code_n(c) == 40 && code_k(c) == 20
@test describe(normal_subgroup(G)) == "C$m"
@test small_group_identification(G) == (20, 4)

# [[48, 8, 6]]
m = 12
r, s, GA, G = semidirectproduct(m)
a_elts = [one(r), r^10]
b_elts = [one(r), s*r^8, r^9, r^4, s*r^2, r^5]
c = get_code(a_elts, b_elts, GA)
@test order(G) == 2*m
@test describe(G) == "D$(m*2)"
@test code_n(c) == 48 && code_k(c) == 8
@test describe(normal_subgroup(G)) == "C$m"
@test small_group_identification(G) == (24, 6)

# [[48, 12, 4]]
r, s, GA, G = semidirectproduct(m)
a_elts = [one(r), r^3]
b_elts = [one(r), s*r^7, r^3, r^4, s*r^10, r^7]
c = get_code(a_elts, b_elts, GA)
@test order(G) == 2*m
@test describe(G) == "D$(m*2)"
@test code_n(c) == 48 && code_k(c) == 12
@test describe(normal_subgroup(G)) == "C$m"
@test small_group_identification(G) == (24, 6)

# [[48, 16, 3]]
r, s, GA, G = semidirectproduct(m)
a_elts = [one(r), r^8]
b_elts = [one(r), s*r^8, r^9, r^8, s*r^4, r^5]
c = get_code(a_elts, b_elts, GA)
@test order(G) == 2*m
@test describe(G) == "D$(m*2)"
@test code_n(c) == 48 && code_k(c) == 16
@test describe(normal_subgroup(G)) == "C$m"
@test small_group_identification(G) == (24, 6)

# [[48, 24, 2]]
r, s, GA, G = semidirectproduct(m)
a_elts = [one(r), r^6]
b_elts = [one(r), s*r^11, r^6, s*r^5, r, r^7]
c = get_code(a_elts, b_elts, GA)
@test order(G) == 2*m
@test describe(G) == "D$(m*2)"
@test code_n(c) == 48 && code_k(c) == 24
@test describe(normal_subgroup(G)) == "C$m"
@test small_group_identification(G) == (24, 6)

# [[56, 8, 7]]
m = 14
r, s, GA, G = semidirectproduct(m)
a_elts = [one(r), r^4]
b_elts = [one(r), s*r^11, r^7, s*r^5, r^12, r^9]
c = get_code(a_elts, b_elts, GA)
@test order(G) == 2*m
@test describe(G) == "D$(m*2)"
@test code_n(c) == 56 && code_k(c) == 8
@test describe(normal_subgroup(G)) == "C$m"
@test small_group_identification(G) == (28, 3)

# [[56, 28, 2]]
r, s, GA, G = semidirectproduct(m)
a_elts = [one(r), r^7]
b_elts = [one(r), s*r^2, r^7, r^8, s*r^9, r]
c = get_code(a_elts, b_elts, GA)
@test order(G) == 2*m
@test describe(G) == "D$(m*2)"
@test code_n(c) == 56 && code_k(c) == 28
@test describe(normal_subgroup(G)) == "C$m"
@test small_group_identification(G) == (28, 3)

# [[60, 12, 5]]
m = 15
r, s, GA, G = semidirectproduct(m)
a_elts = [one(r), r^12]
b_elts = [one(r), s*r^14, r^5, r^12, s*r^11, r^14]
c = get_code(a_elts, b_elts, GA)
@test order(G) == 2*m
@test describe(G) == "D$(m*2)"
@test code_n(c) == 60 && code_k(c) == 12
@test describe(normal_subgroup(G)) == "C$m"
@test small_group_identification(G) == (30, 3)

# [[60, 20, 3]]
r, s, GA, G = semidirectproduct(m)
a_elts = [one(r), r^5]
b_elts = [one(r), s*r^13, r^5, r^12, s*r^3, r^2]
c = get_code(a_elts, b_elts, GA)
@test order(G) == 2*m
@test describe(G) == "D$(m*2)"
@test code_n(c) == 60 && code_k(c) == 20
@test describe(normal_subgroup(G)) == "C$m"
@test small_group_identification(G) == (30, 3)

# [[64, 8, 8]]
m = 16
r, s, GA, G = semidirectproduct(m)
a_elts = [one(r), r^6]
b_elts = [one(r), s*r^12, s*r^9, r^6, s, s*r]
c = get_code(a_elts, b_elts, GA)
@test order(G) == 2*m
@test describe(G) == "D$(m*2)"
@test code_n(c) == 64 && code_k(c) == 8
@test describe(normal_subgroup(G)) == "C$m"
@test small_group_identification(G) == (32, 18)

# [[64, 16, 8]]
r, s, GA, G = semidirectproduct(m)
a_elts = [one(r), r^4]
b_elts = [one(r), s*r^10, s*r^3, r^4, s*r^14, s*r^7]
c = get_code(a_elts, b_elts, GA)
@test order(G) == 2*m
@test describe(G) == "D$(m*2)"
@test code_n(c) == 64 && code_k(c) == 16
@test describe(normal_subgroup(G)) == "C$m"
@test small_group_identification(G) == (32, 18)

# [[64, 32, 2]]
r, s, GA, G = semidirectproduct(m)
a_elts = [one(r), r^8]
b_elts = [one(r), s*r^11, s*r^12, r^8, s*r^3, s*r^4]
c = get_code(a_elts, b_elts, GA)
@test order(G) == 2*m
@test describe(G) == "D$(m*2)"
@test code_n(c) == 64 && code_k(c) == 32
@test describe(normal_subgroup(G)) == "C$m"
@test small_group_identification(G) == (32, 18)
end
end

0 comments on commit 60ce559

Please sign in to comment.