Skip to content

Commit 292450c

Browse files
committed
new test file
1 parent c2a128d commit 292450c

File tree

2 files changed

+124
-66
lines changed

2 files changed

+124
-66
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# misc codes from the literature
2+
@testitem "Quantum/misc_lit_codes.jl" begin
3+
using Oscar
4+
using CodingTheory
5+
6+
@testset "Misc Codes From Literature" begin
7+
# TODO codes from "LRESC" paper, make tests (long range _ surface code?)
8+
# # the dual of any [3, 2, 2] code is a [3, 1, 3] repetition code
9+
# # but we'll build this the GAP way anyway
10+
# C_GAP = GAP.Globals.BestKnownLinearCode(3, 2, GAP.Globals.GF(2));
11+
# G = GAP.Globals.GeneratorMat(C_GAP);
12+
# y = [GAP.Globals.Int(G[i, j]) for i in 1:2, j in 1:3];
13+
# C32 = LinearCode(y, 2);
14+
# R4 = RepetitionCode(2, 4);
15+
# seed1 = concatenate(C32, R4)
16+
# LRESC1 = HypergraphProductCode(parity_check_matrix(seed1), parity_check_matrix(seed1))
17+
18+
# # unclear as to which [6, 2, 4] code they used here
19+
# C_GAP = GAP.Globals.BestKnownLinearCode(6, 2, GAP.Globals.GF(2));
20+
# G = GAP.Globals.GeneratorMat(C_GAP);
21+
# y = [GAP.Globals.Int(G[i, j]) for i in 1:2, j in 1:6];
22+
# C62 = LinearCode(y, 2)
23+
# R2 = RepetitionCode(2, 2);
24+
# seed2 = concatenate(C62, R2)
25+
# LRESC2 = HypergraphProductCode(parity_check_matrix(seed2), parity_check_matrix(seed2))
26+
27+
# # they either could have used this code or the extended Hamming code below
28+
# C_GAP = GAP.Globals.BestKnownLinearCode(8, 4, GAP.Globals.GF(2));
29+
# G = GAP.Globals.GeneratorMat(C_GAP);
30+
# y = [GAP.Globals.Int(G[i, j]) for i in 1:4, j in 1:8];
31+
# C84 = LinearCode(y, 2)
32+
# R3 = RepetitionCode(2, 3);
33+
# seed3 = concatenate(C84, R3)
34+
# LRESC3 = HypergraphProductCode(parity_check_matrix(seed3), parity_check_matrix(seed3))
35+
36+
# ext_Ham = extend(HammingCode(2, 3))
37+
# seed3_alt = concatenate(ext_Ham, R3)
38+
# LRESC3_alt = HypergraphProductCode(parity_check_matrix(seed3_alt), parity_check_matrix(seed3_alt))
39+
40+
# julia> are_permutation_equivalent(C84, ext_Ham)
41+
# (false, missing)
42+
43+
44+
45+
46+
47+
# radial codes
48+
# using StatsBase, Graphs, Oscar, CodingTheory
49+
# F = Oscar.Nemo.Native.GF(2)
50+
# S, x = polynomial_ring(F, :x)
51+
# l = 5
52+
# R, _ = residue_ring(S, x^l - 1)
53+
# A1 = matrix(R, 3, 3,
54+
# [x^3, x^2, x,
55+
# x^4, x^1, x^4,
56+
# x, x^2, x^3])
57+
# A2 = matrix(R, 3, 3,
58+
# [x^3, x^3, 1,
59+
# x, 1, x,
60+
# x^4, x^2, 1])
61+
# code = LiftedProductCode(A1, A2)
62+
# # [[90, 8]]_2 CSS stabilizer code
63+
# # julia> check_weights(code)
64+
# # (w_X, q_X, w_Z, q_Z) = (6, 3, 6, 3)
65+
# L_X = LDPCCode(code.X_stabs);
66+
# G_X, _, _ = Tanner_graph(L_X);
67+
# D_X = DiGraph(G_X);
68+
# L_X_cycles = CodingTheory._modified_hawick_james(D_X, 12);
69+
# countmap(length.(L_X_cycles))
70+
# # Dict{Int64, Int64} with 3 entries:
71+
# # 6 => 48
72+
# # 10 => 4842
73+
# # 8 => 777
74+
# L_Z = LDPCCode(code.Z_stabs);
75+
# G_Z, _, _ = Tanner_graph(L_Z);
76+
# D_Z = DiGraph(G_Z);
77+
# L_Z_cycles = CodingTheory._modified_hawick_james(D_Z, 12);
78+
# countmap(length.(L_Z_cycles))
79+
# # Dict{Int64, Int64} with 3 entries:
80+
# # 6 => 20
81+
# # 10 => 4074
82+
# # 8 => 678
83+
84+
# l = 11
85+
# R, _ = residue_ring(S, x^l - 1)
86+
# A1 = matrix(R, 4, 4,
87+
# [x^10, x^10, x, x^6,
88+
# x^4, x^7, x^5, x^2,
89+
# x^8, x^10, x^6, x^9,
90+
# x, x^6, 1, x^6])
91+
# A2 = matrix(R, 4, 4,
92+
# [x^9, x^5, x^8, x^3,
93+
# x^5, x^4, x, 1,
94+
# 1, x^4, x^6, x^10,
95+
# x^2, x^8, x^4, x^2])
96+
# code = LiftedProductCode(A1, A2)
97+
# # [[352, 18]]_2 CSS stabilizer code
98+
# # julia> check_weights(code)
99+
# # (w_X, q_X, w_Z, q_Z) = (8, 4, 8, 4)
100+
# L_X = LDPCCode(code.X_stabs);
101+
# G_X, _, _ = Tanner_graph(L_X);
102+
# D_X = DiGraph(G_X);
103+
# L_X_cycles = CodingTheory._modified_hawick_james(D_X, 12);
104+
# countmap(length.(L_X_cycles))
105+
# # Dict{Int64, Int64} with 3 entries:
106+
# # 6 => 96
107+
# # 10 => 61668
108+
# # 8 => 3970
109+
# L_Z = LDPCCode(code.Z_stabs);
110+
# G_Z, _, _ = Tanner_graph(L_Z);
111+
# D_Z = DiGraph(G_Z);
112+
# L_Z_cycles = CodingTheory._modified_hawick_james(D_Z, 12);
113+
# countmap(length.(L_Z_cycles))
114+
# # Dict{Int64, Int64} with 3 entries:
115+
# # 6 => 72
116+
# # 10 => 60787
117+
# # 8 => 3954
118+
end
119+
end

test/Quantum/product_codes_test.jl

Lines changed: 5 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -517,11 +517,7 @@
517517
Q = BivariateBicycleCode(a, b)
518518
@test length(Q) == 126
519519
@test dimension(Q) == 8
520-
<<<<<<< HEAD
521520
@test_broken minimum_distance(S) == 10
522-
=======
523-
# @test minimum_distance(S) == 10
524-
>>>>>>> pr/37
525521

526522
# [[150, 16, 8]]
527523
l = 5
@@ -554,62 +550,6 @@
554550
Q = BivariateBicycleCode(a, b)
555551
@test length(Q) == 180
556552
@test dimension(Q) == 8
557-
<<<<<<< HEAD
558-
@test_broken minimum_distance(S) == 16
559-
end
560-
561-
@testset "HyperBicycleCode" begin
562-
# Quantum ``hyperbicycle'' low-density parity check codes with finite rate
563-
564-
# Odd-distance rotated CSS toric codes
565-
# f1 = 1 + x^(2 * t^2 + 1)
566-
# f2 = x * (1 + x^(2 * t^2 - 1))
567-
# t - # errors
568-
# [[2t^2 + 2(t + 1)^2, 2, 2t + 1]]
569-
# [[10, 2, 3]]
570-
# [[26, 2, 5]]
571-
# [[50, 2, 7]]
572-
# [[82, 2, 9]]
573-
# ...
574-
575-
# Figure 2
576-
F = Oscar.Nemo.Native.GF(2)
577-
S, x = polynomial_ring(F, :x)
578-
l = 21
579-
R = ResidueRing(S, x^l - 1)
580-
h = R(1 + x + x^3)
581-
A = residue_polynomial_to_circulant_matrix(h)
582-
a1 = A[1:7, 1:7]
583-
a2 = A[1:7, 8:14]
584-
a3 = A[1:7, 15:21]
585-
χ = 1
586-
Q = HyperBicycleCodeCSS([a1, a2, a3], [a1, a2, a3], χ)
587-
@test length(Q) == 294
588-
@test dimension(Q) == 18
589-
590-
# Example 6
591-
l = 30
592-
R = ResidueRing(S, x^l - 1)
593-
h = R(1 + x + x^3 + x^5)
594-
A = residue_polynomial_to_circulant_matrix(h)
595-
a1 = A[1:15, 1:15]
596-
a2 = A[1:15, 16:30]
597-
χ = 1
598-
Q = HyperBicycleCodeCSS([a1, a2], [a1, a2], χ)
599-
@test length(Q) == 900
600-
@test dimension(Q) == 50
601-
602-
# Example 13
603-
l = 17
604-
R = ResidueRing(S, x^l - 1)
605-
h = R(x^(div(17 - 9, 2)) * (1 + x + x^3 + x^6 + x^8 + x^9))
606-
A = residue_polynomial_to_circulant_matrix(h)
607-
χ = 1
608-
Q = HyperBicycleCode([A], [A], χ)
609-
@test length(Q) == 289
610-
@test dimension(Q) == 81
611-
=======
612-
# @test minimum_distance(S) == 16
613553

614554
# Table 1 of https://arxiv.org/pdf/2404.17676
615555
# [[72, 8, 6]]
@@ -621,7 +561,7 @@
621561
Q = BivariateBicycleCode(a, b)
622562
@test length(Q) == 72
623563
@test dimension(Q) == 8
624-
# @test minimum_distance(S) == 6
564+
@test_broken minimum_distance(S) == 6
625565

626566
# [[90, 8, 6]]
627567
l = 9
@@ -632,7 +572,7 @@
632572
Q = BivariateBicycleCode(a, b)
633573
@test length(Q) == 90
634574
@test dimension(Q) == 8
635-
# @test minimum_distance(S) == 6
575+
@test_broken minimum_distance(S) == 6
636576

637577
# [[120, 8, 8]]
638578
l = 12
@@ -643,7 +583,7 @@
643583
Q = BivariateBicycleCode(a, b)
644584
@test length(Q) == 120
645585
@test dimension(Q) == 8
646-
# @test minimum_distance(S) == 8
586+
@test_broken minimum_distance(S) == 8
647587

648588
# [[150, 8, 8]]
649589
l = 15
@@ -654,7 +594,7 @@
654594
Q = BivariateBicycleCode(a, b)
655595
@test length(Q) == 150
656596
@test dimension(Q) == 8
657-
# @test minimum_distance(S) == 8
597+
@test_broken minimum_distance(S) == 8
658598

659599
# [[196, 12, 8]]
660600
l = 14
@@ -665,7 +605,6 @@
665605
Q = BivariateBicycleCode(a, b)
666606
@test length(Q) == 196
667607
@test dimension(Q) == 12
668-
# @test minimum_distance(S) == 8
669-
>>>>>>> pr/37
608+
@test_broken minimum_distance(S) == 8
670609
end
671610
end

0 commit comments

Comments
 (0)