Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: test consistency of Bivariate Bicycle code using LPCode constructor #372

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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{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}
}
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)
- [bravyi2024high](@cite)

For classical code construction routines:
- [muller1954application](@cite)
Expand Down
30 changes: 30 additions & 0 deletions ext/QuantumCliffordHeckeExt/lifted_product.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,36 @@ julia> code_n(c2), code_k(c2)
- When the base matrices of the `LPCode` are 1×1 and their elements are sums of cyclic permutations, the code is called a generalized bicycle code [`generalized_bicycle_codes`](@ref).
- When the two matrices are adjoint to each other, the code is called a bicycle code [`bicycle_codes`](@ref).

# Examples

Bivariate Bicycle codes belong to a wider class of generalized bicycle (GB) codes, which
are further generalized into of two block group algebra (2BGA) codes. They can be viewed
as a special case of Lifted Product construction based on abelian group `ℤₗ x ℤₘ` where `ℤⱼ`
cyclic group of order `j`.

A [[756, 16, ≤ 34]] code from Table 3 of [bravyi2024high](@cite).

```jldoctest
julia> import Hecke: group_algebra, GF, abelian_group, gens;

julia> l=21; m=18;

julia> GA = group_algebra(GF(2), abelian_group([l, m]));

julia> x = gens(GA)[1];

julia> y = gens(GA)[2];

julia> A = reshape([x^3 + y^10 + y^17], (1, 1));

julia> B = reshape([y^5 + x^3 + x^19], (1, 1));

julia> c1 = LPCode(A, B);

julia> code_n(c1), code_k(c1)
(756, 16)
```

## The representation function

We use the default representation function `Hecke.representation_matrix` to convert a `GF(2)`-group algebra element to a binary matrix.
Expand Down
191 changes: 191 additions & 0 deletions test/test_ecc_bivaraite_bicycle.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
@testitem "ECC Bivaraite Bicycle" begin
using Hecke
using Hecke: group_algebra, GF, abelian_group, gens
using QuantumClifford.ECC: LPCode, code_k, code_n

@testset "Reproduce Table 3 bravyi2024high" begin
# [[72, 12, 6]]
l=6; m=6
GA = group_algebra(GF(2), abelian_group([l, m]))
x = gens(GA)[1]
y = gens(GA)[2]
A = reshape([x^3 + y + y^2], (1, 1))
B = reshape([y^3 + x + x^2], (1, 1))
c = LPCode(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 = gens(GA)[1]
y = gens(GA)[2]
A = reshape([x^9 + y + y^2], (1, 1))
B = reshape([1 + x^2 + x^7], (1, 1))
c = LPCode(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 = gens(GA)[1]
y = gens(GA)[2]
A = reshape([x^3 + y + y^2], (1, 1))
B = reshape([y^3 + x + x^2], (1, 1))
c = LPCode(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 = gens(GA)[1]
y = gens(GA)[2]
A = reshape([x^3 + y + y^2], (1, 1))
B = reshape([y^3 + x + x^2], (1, 1))
c = LPCode(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 = gens(GA)[1]
y = gens(GA)[2]
A = reshape([x^3 + y^2 + y^7], (1, 1))
B = reshape([y^3 + x + x^2], (1, 1))
c = LPCode(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 = gens(GA)[1]
y = gens(GA)[2]
A = reshape([x^9 + y + y^2], (1, 1))
B = reshape([y^3 + x^25 + x^26], (1, 1))
c = LPCode(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 = gens(GA)[1]
y = gens(GA)[2]
A = reshape([x^3 + y^10 + y^17], (1, 1))
B = reshape([y^5 + x^3 + x^19], (1, 1))
c = LPCode(A, B)
@test code_n(c) == 756 && code_k(c) == 16
end

@testset "Reproduce Table 1 berthusen2024toward" begin
# [[72, 8, 6]]
l=12; m=3
GA = group_algebra(GF(2), abelian_group([l, m]))
x = gens(GA)[1]
y = gens(GA)[2]
A = reshape([x^9 + y + y^2], (1, 1))
B = reshape([1 + x + x^11], (1, 1))
c = LPCode(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 = gens(GA)[1]
y = gens(GA)[2]
A = reshape([x^8 + y^4 + y], (1, 1))
B = reshape([y^5 + x^8 + x^7], (1, 1))
c = LPCode(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 = gens(GA)[1]
y = gens(GA)[2]
A = reshape([x^10 + y^4 + y], (1, 1))
B = reshape([1 + x + x^2], (1, 1))
c = LPCode(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 = gens(GA)[1]
y = gens(GA)[2]
A = reshape([x^5 + y^2 + y^3], (1, 1))
B = reshape([y^2 + x^7 + x^6], (1, 1))
c = LPCode(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 = gens(GA)[1]
y = gens(GA)[2]
A = reshape([x^6 + y^5 + y^6], (1, 1))
B = reshape([1 + x^4 + x^13], (1, 1))
c = LPCode(A, B)
@test code_n(c) == 196 && code_k(c) == 12
end

@testset "Reproduce Table 1 wang2024coprime" begin
# [[54, 8, 6]]
l=3; m=9
GA = group_algebra(GF(2), abelian_group([l, m]))
x = gens(GA)[1]
y = gens(GA)[2]
A = reshape([1 + y^2 + y^4], (1, 1))
B = reshape([y^3 + x + x^2], (1, 1))
c = LPCode(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 = gens(GA)[1]
y = gens(GA)[2]
A = reshape([x^3 + y^5 + y^6], (1, 1))
B = reshape([y^2 + x^3 + x^5], (1, 1))
c = LPCode(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 = gens(GA)[1]
y = gens(GA)[2]
A = reshape([1 + y^2 + y^10], (1, 1))
B = reshape([y^3 + x + x^2], (1, 1))
c = LPCode(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 = gens(GA)[1]
y = gens(GA)[2]
A = reshape([1 + y^6 + y^8], (1, 1))
B = reshape([y^5 + x + x^4], (1, 1))
c = LPCode(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 = gens(GA)[1]
y = gens(GA)[2]
A = reshape([1 + y^10 + y^14], (1, 1))
B = reshape([y^12 + x + x^2], (1, 1))
c = LPCode(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 = gens(GA)[1]
y = gens(GA)[2]
A = reshape([x^3 + y + y^2], (1, 1))
B = reshape([y^6+ x^4 + x^5], (1, 1))
c = LPCode(A, B)
@test code_n(c) == 180 && code_k(c) == 8
end
end
Loading