Skip to content

Commit

Permalink
introduce tests for 2BGA code
Browse files Browse the repository at this point in the history
  • Loading branch information
Fe-r-oz committed Oct 14, 2024
1 parent 2b8e81f commit b0fbb53
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
11 changes: 11 additions & 0 deletions docs/src/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -487,3 +487,14 @@ @article{anderson2014fault
year={2014},
publisher={APS}
}

@article{lin2024quantum,
title={Quantum two-block group algebra codes},
author={Lin, Hsiang-Ku and Pryadko, Leonid P},
journal={Physical Review A},
volume={109},
number={2},
pages={022407},
year={2024},
publisher={APS}
}
1 change: 1 addition & 0 deletions docs/src/references.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ For quantum code construction routines:
- [steane1999quantum](@cite)
- [campbell2012magic](@cite)
- [anderson2014fault](@cite)
- [lin2024quantum](@cite)

For classical code construction routines:
- [muller1954application](@cite)
Expand Down
23 changes: 18 additions & 5 deletions ext/QuantumCliffordHeckeExt/lifted_product.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,31 @@ code_n(c::LPCode) = size(c.repr(zero(c.GA)), 2) * (size(c.A, 2) * size(c.B, 1) +
code_s(c::LPCode) = size(c.repr(zero(c.GA)), 1) * (size(c.A, 1) * size(c.B, 1) + size(c.A, 2) * size(c.B, 2))

"""
Two-block group algebra (2GBA) codes, which are a special case of lifted product codes
Two-block group algebra (2BGA) codes, which are a special case of lifted product codes
from two group algebra elements `a` and `b`, used as `1x1` base matrices.
[[70, 8, 10]] 2BGA code from Table 1 of [lin2024quantum](@cite) with cyclic group of
order `l = 35`.
```jldoctest
julia> l = 35;
julia> c1 = generalized_bicycle_codes([0, 15, 16, 18], [0, 1, 24, 27], l);
julia> code_n(c1), code_k(c1)
(70, 8)
```
See also: [`LPCode`](@ref), [`generalized_bicycle_codes`](@ref), [`bicycle_codes`](@ref)
""" # TODO doctest example
"""
function two_block_group_algebra_codes(a::GroupAlgebraElem, b::GroupAlgebraElem)
A = reshape([a], (1, 1))
B = reshape([b], (1, 1))
LPCode(A, B)
end

"""
Generalized bicycle codes, which are a special case of 2GBA codes (and therefore of lifted product codes).
Generalized bicycle codes, which are a special case of 2BGA codes (and therefore of lifted product codes).
Here the group is chosen as the cyclic group of order `l`,
and the base matrices `a` and `b` are the sum of the group algebra elements corresponding to the shifts `a_shifts` and `b_shifts`.
Expand All @@ -166,8 +178,9 @@ julia> code_n(c), code_k(c)
(254, 28)
```
""" # TODO doctest example
function generalized_bicycle_codes(a_shifts::Array{Int}, b_shifts::Array{Int}, l::Int)
GA = group_algebra(GF(2), abelian_group(l))
function generalized_bicycle_codes(a_shifts::Array{Int}, b_shifts::Array{Int}, sg::Tuple{Int,Int})
l, i = sg
GA = group_algebra(GF(2), Hecke.small_group(l, i))
a = sum(GA[n%l+1] for n in a_shifts)
b = sum(GA[n%l+1] for n in b_shifts)
two_block_group_algebra_codes(a, b)
Expand Down
16 changes: 16 additions & 0 deletions test/test_ecc_2bga.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@testitem "ECC 2BGA" begin
using Hecke
using QuantumClifford.ECC: generalized_bicycle_codes, code_k, code_n

# codes taken from Table 1 of [lin2024quantum](@cite)
@test code_n(generalized_bicycle_codes([0 , 15, 16, 18], [0 , 1, 24, 27], 35)) == 70
@test code_k(generalized_bicycle_codes([0 , 15, 16, 18], [0 , 1, 24, 27], 35)) == 8
@test code_n(generalized_bicycle_codes([0 , 1, 3, 7], [0 , 1, 12, 19], 27)) == 54
@test code_k(generalized_bicycle_codes([0 , 1, 3, 7], [0 , 1, 12, 19], 27)) == 6
@test code_n(generalized_bicycle_codes([0 , 10, 6, 13], [0 , 25, 16, 12], 30)) == 60
@test code_k(generalized_bicycle_codes([0 , 10, 6, 13], [0 , 25, 16, 12], 30)) == 6
@test code_n(generalized_bicycle_codes([0 , 9, 28, 31], [0 , 1, 21, 34], 36)) == 72
@test code_k(generalized_bicycle_codes([0 , 9, 28, 31], [0 , 1, 21, 34], 36)) == 8
@test code_n(generalized_bicycle_codes([0 , 9, 28, 13], [0 , 1, 21, 34], 36)) == 72
@test code_k(generalized_bicycle_codes([0 , 9, 28, 13], [0 , 1, 3, 22], 36)) == 10
end

0 comments on commit b0fbb53

Please sign in to comment.