@@ -917,7 +917,7 @@ function BivariateBicycleCode(a::T, b::T) where T <: Union{MPolyQuoRingElem{FqMP
917917 l = exps[1 ][1 ]
918918 end
919919 end
920-
920+
921921 x = matrix (F, [mod1 (i + 1 , l) == j ? 1 : 0 for i in 1 : l, j in 1 : l]) ⊗ identity_matrix (F, m)
922922 y = identity_matrix (F, l) ⊗ matrix (F, [mod1 (i + 1 , m) == j ? 1 : 0 for i in 1 : m, j in 1 : m])
923923
@@ -943,5 +943,56 @@ function BivariateBicycleCode(a::T, b::T) where T <: Union{MPolyQuoRingElem{FqMP
943943 end
944944 end
945945
946+
947+ return CSSCode (hcat (A, B), hcat (transpose (B), transpose (A)))
948+ end
949+
950+ """
951+ CoPrimeBivariateBicycleCode(a::MPolyQuoRingElem{FqMPolyRingElem}, b::MPolyQuoRingElem{FqMPolyRingElem})
952+
953+ Return the coprime bivariate bicycle code defined by the residue ring elements `a` and `b`.
954+
955+ # Note
956+ - This is defined in https://arxiv.org/pdf/2408.10001v1.
957+ """
958+ function CoprimeBivariateBicycleCode (a:: T , b:: T ) where T <: Union{MPolyQuoRingElem{FqMPolyRingElem}, MPolyQuoRingElem{fpMPolyRingElem}}
959+ R = parent (a)
960+ R == parent (b) || throw (DomainError (" Polynomials must have the same parent." ))
961+ F = base_ring (base_ring (a))
962+ order (F) == 2 || throw (DomainError (" This code family is currently only defined over binary fields." ))
963+ length (symbols (parent (a))) == 1 || throw (DomainError (" Polynomials must be over one variable." ))
964+ g = gens (modulus (R))
965+
966+ m = - 1
967+ l = - 1
968+
969+ exps = collect (exponents (g[1 ]))[1 ][1 ]
970+ length (exps) == 1 || throw (ArgumentError (" Moduli of the incorrect form." ))
971+ facs = factor (ZZ (exps)). fac
972+ pfacs = collect (keys (facs))
973+ pexps = collect (values (facs))
974+
975+ l = Int (pfacs[1 ]^ pexps[1 ])
976+ m = Int (pfacs[2 ]^ pexps[2 ])
977+
978+ length (pfacs) == 2 ? (gcd ([l, m]) == 1 ?
979+ nothing : throw (ArgumentError (" l and m must be coprime numbers." ))) : throw (ArgumentError (" Moduli of the incorrect form." ))
980+
981+ x = matrix (F, [mod1 (i + 1 , l) == j ? 1 : 0 for i in 1 : l, j in 1 : l]) ⊗ identity_matrix (F, m)
982+ y = identity_matrix (F, l) ⊗ matrix (F, [mod1 (i + 1 , m) == j ? 1 : 0 for i in 1 : m, j in 1 : m])
983+
984+ P = x* y
985+ A = zero_matrix (F, exps, exps)
986+ for ex in exponents (lift (a))
987+ power, _ = findmax (ex)
988+ A += P^ power
989+ end
990+
991+ B = zero_matrix (F, exps, exps)
992+ for ex in exponents (lift (b))
993+ power, _ = findmax (ex)
994+ B += P^ power
995+ end
996+
946997 return CSSCode (hcat (A, B), hcat (transpose (B), transpose (A)))
947998end
0 commit comments