Skip to content

Commit

Permalink
add check_repr_commutation_relation to test the CSS orthogonality c…
Browse files Browse the repository at this point in the history
…ondition for 2BGA's Group Algebra with a General Group `G` (#403)



Co-authored-by: Stefan Krastanov <github.acc@krastanov.org>
  • Loading branch information
Fe-r-oz and Krastanov authored Nov 5, 2024
1 parent 406e5ea commit 5531336
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
15 changes: 15 additions & 0 deletions ext/QuantumCliffordHeckeExt/util.jl
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions src/ecc/codes/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions test/test_ecc_base.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Test
using QuantumClifford
using QuantumClifford.ECC
using QuantumClifford.ECC: check_repr_commutation_relation
using InteractiveUtils

import Nemo: GF
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5531336

Please sign in to comment.