|
| 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 |
0 commit comments