Skip to content

Commit 40924b8

Browse files
Fe-r-ozKrastanov
andauthored
add tests and examples of Cₘ × C₂ 2BGA codes (#392)
Co-authored-by: Stefan Krastanov <[email protected]>
1 parent 5531336 commit 40924b8

File tree

3 files changed

+154
-4
lines changed

3 files changed

+154
-4
lines changed

docs/src/references.bib

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,3 +512,14 @@ @article{anderson2014fault
512512
year={2014},
513513
publisher={APS}
514514
}
515+
516+
@article{lin2024quantum,
517+
title={Quantum two-block group algebra codes},
518+
author={Lin, Hsiang-Ku and Pryadko, Leonid P},
519+
journal={Physical Review A},
520+
volume={109},
521+
number={2},
522+
pages={022407},
523+
year={2024},
524+
publisher={APS}
525+
}

ext/QuantumCliffordHeckeExt/lifted_product.jl

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,32 @@ code_s(c::LPCode) = size(c.repr(zero(c.GA)), 1) * (size(c.A, 1) * size(c.B, 1) +
153153
Two-block group algebra (2GBA) codes, which are a special case of lifted product codes
154154
from two group algebra elements `a` and `b`, used as `1x1` base matrices.
155155
156+
Here is an example of a [[56, 28, 2]] 2BGA code from Table 2 of [lin2024quantum](@cite)
157+
with direct product of `C₄ x C₂`.
158+
159+
```jldoctest
160+
julia> import Hecke: group_algebra, GF, abelian_group, gens;
161+
162+
julia> GA = group_algebra(GF(2), abelian_group([14,2]));
163+
164+
julia> x = gens(GA)[1];
165+
166+
julia> s = gens(GA)[2];
167+
168+
julia> A = 1 + x^7
169+
170+
julia> B = 1 + x^7 + s + x^8 + s*x^7 + x
171+
172+
julia> c = two_block_group_algebra_codes(A,B);
173+
174+
julia> code_n(c), code_k(c)
175+
(56, 28)
176+
```
177+
156178
See also: [`LPCode`](@ref), [`generalized_bicycle_codes`](@ref), [`bicycle_codes`](@ref)
157-
""" # TODO doctest example
179+
"""
158180
function two_block_group_algebra_codes(a::GroupAlgebraElem, b::GroupAlgebraElem)
159-
A = reshape([a], (1, 1))
160-
B = reshape([b], (1, 1))
161-
LPCode(A, B)
181+
LPCode([a;;], [b;;])
162182
end
163183

164184
"""

test/test_ecc_2bga.jl

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
@testitem "ECC 2BGA" begin
2+
using Hecke
3+
using Hecke: group_algebra, GF, abelian_group, gens
4+
using QuantumClifford.ECC: LPCode, code_k, code_n
5+
6+
@testset "Reproduce Table 2 lin2024quantum" begin # TODO these tests should probably just use the `two_block_group_algebra_codes` function as that would make them much shorter and simpler
7+
# codes taken from Table 2 of [lin2024quantum](@cite)
8+
9+
# m = 4
10+
GA = group_algebra(GF(2), abelian_group([4,2]))
11+
x = gens(GA)[1]
12+
s = gens(GA)[2]
13+
A = [1 + x;;]
14+
B = [1 + x + s + x^2 + s*x + s*x^3;;]
15+
c = LPCode(A,B)
16+
# [[16, 2, 4]] 2BGA code
17+
@test code_n(c) == 16 && code_k(c) == 2
18+
A = [1 + x;;]
19+
B = [1 + x + s + x^2 + s*x + x^3;;]
20+
c = LPCode(A,B)
21+
# [[16, 4, 4]] 2BGA code
22+
@test code_n(c) == 16 && code_k(c) == 4
23+
A = [1 + s;;]
24+
B = [1 + x + s + x^2 + s*x + x^2;;]
25+
c = LPCode(A,B)
26+
# [[16, 8, 2]] 2BGA code
27+
@test code_n(c) == 16 && code_k(c) == 8
28+
29+
# m = 6
30+
GA = group_algebra(GF(2), abelian_group([6,2]))
31+
x = gens(GA)[1]
32+
s = gens(GA)[2]
33+
A = [1 + x;;]
34+
B = [1 + x^3 + s + x^4 + x^2 + s*x;;]
35+
c = LPCode(A,B)
36+
# [[24, 4, 5]] 2BGA code
37+
@test code_n(c) == 24 && code_k(c) == 4
38+
A = [1 + x^3;;]
39+
B = [1 + x^3 + s + x^4 + s*x^3 + x;;]
40+
c = LPCode(A,B)
41+
# [[24, 12, 2]] 2BGA code
42+
@test code_n(c) == 24 && code_k(c) == 12
43+
44+
# m = 8
45+
GA = group_algebra(GF(2), abelian_group([8,2]))
46+
x = gens(GA)[1]
47+
s = gens(GA)[2]
48+
A = [1 + x^6;;]
49+
B = [1 + s*x^7 + s*x^4 + x^6 + s*x^5 + s*x^2;;]
50+
c = LPCode(A,B)
51+
# [[32, 8, 4]] 2BGA code
52+
@test code_n(c) == 32 && code_k(c) == 8
53+
A = [1 + s*x^4;;]
54+
B = [1 + s*x^7 + s*x^4 + x^6 + x^3 + s*x^2;;]
55+
c = LPCode(A,B)
56+
# [[32, 16, 2]] 2BGA code
57+
@test code_n(c) == 32 && code_k(c) == 16
58+
59+
# m = 10
60+
GA = group_algebra(GF(2), abelian_group([10,2]))
61+
x = gens(GA)[1]
62+
s = gens(GA)[2]
63+
A = [1 + x;;]
64+
B = [1 + x^5 + x^6 + s*x^6 + x^7 + s*x^3;;]
65+
c = LPCode(A,B)
66+
# [[40, 4, 8]] 2BGA code
67+
@test code_n(c) == 40 && code_k(c) == 4
68+
A = [1 + x^6;;]
69+
B = [1 + x^5 + s + x^6 + x + s*x^2;;]
70+
c = LPCode(A,B)
71+
# [[40, 8, 5]] 2BGA code
72+
@test code_n(c) == 40 && code_k(c) == 8
73+
A = [1 + x^5;;]
74+
B = [1 + x^5 + s + x^6 + s*x^5 + x;;]
75+
c = LPCode(A,B)
76+
# [[40, 20, 2]] 2BGA code
77+
@test code_n(c) == 40 && code_k(c) == 20
78+
79+
# m = 12
80+
GA = group_algebra(GF(2), abelian_group([12,2]))
81+
x = gens(GA)[1]
82+
s = gens(GA)[2]
83+
A = [1 + s*x^10;;]
84+
B = [1 + x^3 + s*x^6 + x^4 + x^7 + x^8;;]
85+
c = LPCode(A,B)
86+
# [[48, 8, 6]] 2BGA code
87+
@test code_n(c) == 48 && code_k(c) == 8
88+
A = [1 + x^3;;]
89+
B = [1 + x^3 + s*x^6 + x^4 + s*x^9 + x^7;;]
90+
c = LPCode(A,B)
91+
# [[48, 12, 4]] 2BGA code
92+
@test code_n(c) == 48 && code_k(c) == 12
93+
A = [1 + x^4;;]
94+
B = [1 + x^3 + s*x^6 + x^4 + x^7 + s*x^10;;]
95+
c = LPCode(A,B)
96+
# [[48, 16, 3]] 2BGA code
97+
@test code_n(c) == 48 && code_k(c) == 16
98+
A = [1 + s*x^6;;]
99+
B = [1 + x^3 + s*x^6 + x^4 + s*x^9 + s*x^10;;]
100+
c = LPCode(A,B)
101+
# [[48, 24, 2]] 2BGA code
102+
@test code_n(c) == 48 && code_k(c) == 24
103+
104+
# m = 14
105+
GA = group_algebra(GF(2), abelian_group([14,2]))
106+
x = gens(GA)[1]
107+
s = gens(GA)[2]
108+
A = [1 + x^8;;]
109+
B = [1 + x^7 + s + x^8 + x^9 + s*x^4;;]
110+
c = LPCode(A,B)
111+
# [[56, 8, 7]] 2BGA code
112+
@test code_n(c) == 56 && code_k(c) == 8
113+
A = [1 + x^7;;]
114+
B = [1 + x^7 + s + x^8 + s*x^7 + x;;]
115+
c = LPCode(A,B)
116+
# [[56, 28, 2]] 2BGA code
117+
@test code_n(c) == 56 && code_k(c) == 28
118+
end
119+
end

0 commit comments

Comments
 (0)