diff --git a/ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl b/ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl index 29e9de8ce..b8508ff66 100644 --- a/ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl +++ b/ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl @@ -5,14 +5,15 @@ using DocStringExtensions import QuantumClifford, LinearAlgebra import Hecke: Group, GroupElem, AdditiveGroup, AdditiveGroupElem, GroupAlgebra, GroupAlgebraElem, FqFieldElem, representation_matrix, dim, base_ring, - multiplication_table, coefficients, abelian_group, group_algebra + multiplication_table, coefficients, abelian_group, group_algebra, rand import Nemo import Nemo: characteristic, matrix_repr, GF, ZZ, lift import QuantumClifford.ECC: AbstractECC, CSS, ClassicalCode, hgp, code_k, code_n, code_s, iscss, parity_checks, parity_checks_x, parity_checks_z, parity_checks_xz, - two_block_group_algebra_codes, generalized_bicycle_codes, bicycle_codes + two_block_group_algebra_codes, generalized_bicycle_codes, bicycle_codes, check_repr_commutation_relation +include("util.jl") include("types.jl") include("lifted.jl") include("lifted_product.jl") diff --git a/ext/QuantumCliffordHeckeExt/util.jl b/ext/QuantumCliffordHeckeExt/util.jl new file mode 100644 index 000000000..d8fc65e85 --- /dev/null +++ b/ext/QuantumCliffordHeckeExt/util.jl @@ -0,0 +1,15 @@ +""" +Checks the commutation relation between the left and right representation matrices +for two randomly-sampled elements `a` and `b` in the group algebra `ℱ[G]` with a general group `G`. +It verifies the commutation relation that states, `L(a)·R(b) = R(b)·L(a)`. This +property shows that matrices from the left and right representation sets commute +with each other, which is an important property related to the CSS orthogonality +condition. +""" +function check_repr_commutation_relation(GA::GroupAlgebra) + a, b = rand(GA), rand(GA) + # Check commutation relation: L(a)R(b) = R(b)L(a) + L_a = representation_matrix(a) + R_b = representation_matrix(b, :right) + return L_a * R_b == R_b * L_a +end diff --git a/src/ecc/codes/util.jl b/src/ecc/codes/util.jl index 1063785f9..b96a75120 100644 --- a/src/ecc/codes/util.jl +++ b/src/ecc/codes/util.jl @@ -6,3 +6,6 @@ function hgp(h₁,h₂) hz = hcat(kron(LinearAlgebra.I(n₁), h₂), kron(h₁', LinearAlgebra.I(r₂))) hx, hz end + +"""Implemented in a package extension with Hecke.""" +function check_repr_commutation_relation end diff --git a/test/test_ecc_base.jl b/test/test_ecc_base.jl index 9f4a5ec9e..26b00c8f3 100644 --- a/test/test_ecc_base.jl +++ b/test/test_ecc_base.jl @@ -1,6 +1,7 @@ using Test using QuantumClifford using QuantumClifford.ECC +using QuantumClifford.ECC: check_repr_commutation_relation using InteractiveUtils import Nemo: GF @@ -46,6 +47,7 @@ other_lifted_product_codes = [] # [[882, 24, d≤24]] code from (B1) in Appendix B of [panteleev2021degenerate](@cite) l = 63 GA = group_algebra(GF(2), abelian_group(l)) +@test check_repr_commutation_relation(GA) # TODO use this check more pervasively throughout the test suite A = zeros(GA, 7, 7) x = gens(GA)[] A[LinearAlgebra.diagind(A)] .= x^27