Skip to content

Commit c062a6f

Browse files
committed
🐞🦋 fix generation of classical LiftedCode and code_n, code_k parameters
1 parent def729f commit c062a6f

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ using DocStringExtensions
77
import QuantumClifford, LinearAlgebra
88
import Hecke: Group, GroupElem, AdditiveGroupElem,
99
GroupAlgebra, GroupAlgebraElem, FqFieldElem, representation_matrix, dim, base_ring,
10-
multiplication_table, coefficients, abelian_group, group_algebra, rand
10+
multiplication_table, coefficients, abelian_group, group_algebra, rand, order
1111
import Nemo
1212
import Nemo: characteristic, matrix_repr, GF, ZZ, lift
1313

ext/QuantumCliffordHeckeExt/lifted.jl

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,37 @@ function LiftedCode(group_elem_array::Matrix{<: GroupOrAdditiveGroupElem}; GA::G
8383
end
8484
end
8585

86-
# TODO document and doctest example
86+
"""
87+
Constructs a group algebra code over GF(2) by lifting a matrix of cyclic shifts
88+
(entries mod l) to the group algebra of the abelian group ℤ/lℤ, with 0 mapped
89+
to the identity.
90+
91+
# Example
92+
93+
```jldoctest
94+
julia> base_matrix = [0 0 0 0; 0 1 2 5; 0 6 3 1]; l = 4;
95+
96+
julia> c = LiftedCode(base_matrix, l);
97+
98+
julia> parity_checks(c)
99+
12×16 Matrix{Bool}:
100+
1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0
101+
0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0
102+
0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0
103+
0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1
104+
1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1
105+
0 1 0 0 1 0 0 0 0 0 0 1 1 0 0 0
106+
0 0 1 0 0 1 0 0 1 0 0 0 0 1 0 0
107+
0 0 0 1 0 0 1 0 0 1 0 0 0 0 1 0
108+
1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1
109+
0 1 0 0 0 0 0 1 0 0 1 0 1 0 0 0
110+
0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0
111+
0 0 0 1 0 1 0 0 1 0 0 0 0 0 1 0
112+
113+
julia> code_n(c), code_k(c)
114+
(16, 12)
115+
```
116+
"""
87117
function LiftedCode(shift_array::Matrix{Int}, l::Int; GA::GroupAlgebra=group_algebra(GF(2), abelian_group(l)))
88118
A = zeros(GA, size(shift_array)...)
89119
for i in 1:size(shift_array, 1)
@@ -104,9 +134,9 @@ function concat_lift_repr(repr, mat)
104134
end
105135

106136
function parity_checks(c::LiftedCode)
107-
return lift(c.repr, c.A)
137+
return concat_lift_repr(c.repr, c.A)
108138
end
109139

110-
code_n(c::LiftedCode) = size(c.A, 2) * size(zero(c.GA), 2)
140+
code_n(c::LiftedCode) = size(c.A, 2) * order(group(c.GA))
111141

112-
code_s(c::LiftedCode) = size(c.A, 1) * size(zero(c.GA), 1)
142+
code_s(c::LiftedCode) = size(c.A, 1) * order(group(c.GA))

0 commit comments

Comments
 (0)