Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4cc8eac
🐞🦋 fix generation of classical LiftedCode and code_n, code_s paras, …
Fe-r-oz Jun 26, 2025
63bc79d
🔌use parity_matrix instead of parity_checks
Fe-r-oz Jun 26, 2025
112c76a
🧹 polish
Fe-r-oz Jun 26, 2025
5326e26
🔌 polish 2
Fe-r-oz Jun 26, 2025
5883231
🧾 document the other constructor
Fe-r-oz Jun 26, 2025
fb42147
🧹 polish
Fe-r-oz Jun 26, 2025
42e5bfa
🧹 polish doctest
Fe-r-oz Jun 26, 2025
ac1dd49
🧹 add basic tests test_nowarn that just check there is no method erro…
Fe-r-oz Jun 29, 2025
4e241df
🧹 polish
Fe-r-oz Jun 29, 2025
5bbe0f9
Merge branch 'QuantumSavory:master' into fa/fixclassicallpcode
Fe-r-oz Jul 2, 2025
6bcbc41
add changelog
Fe-r-oz Jul 2, 2025
d8de0ce
Merge branch 'master' into fa/fixclassicallpcode
Fe-r-oz Jul 5, 2025
ee22d33
Merge branch 'master' into fa/fixclassicallpcode
Fe-r-oz Jul 6, 2025
da35de0
Merge branch 'master' into fa/fixclassicallpcode
Fe-r-oz Jul 14, 2025
765bf20
Merge branch 'master' into fa/fixclassicallpcode
Fe-r-oz Jul 17, 2025
aa7fceb
use Hecke.group
Fe-r-oz Jul 17, 2025
af40edb
Merge branch 'QuantumSavory:master' into fa/fixclassicallpcode
Fe-r-oz Jul 21, 2025
286c6e0
Merge branch 'master' into fa/fixclassicallpcode
Fe-r-oz Jul 23, 2025
72d51d7
Merge branch 'master' into fa/fixclassicallpcode
Fe-r-oz Jul 24, 2025
01ca06b
use Hecke.group
Fe-r-oz Jul 25, 2025
c225552
Merge branch 'master' into fa/fixclassicallpcode
Fe-r-oz Jul 25, 2025
6098913
merge conflict update
Fe-r-oz Jul 25, 2025
59d71a5
Merge branch 'QuantumSavory:master' into fa/fixclassicallpcode
Fe-r-oz Jul 25, 2025
5cd71fa
merge conflict cleanup
Fe-r-oz Jul 25, 2025
826fd6f
Merge branch 'master' into fa/fixclassicallpcode
Fe-r-oz Aug 9, 2025
1b39d9a
merge conflict cleanup: since code_k is recently defined in QECCore f…
Fe-r-oz Aug 9, 2025
b5d63ca
Merge branch 'master' into fa/fixclassicallpcode
Fe-r-oz Aug 10, 2025
84b9931
Merge branch 'master' into fa/fixclassicallpcode
Fe-r-oz Aug 23, 2025
c8c7230
Merge branch 'QuantumSavory:master' into fa/fixclassicallpcode
Fe-r-oz Aug 26, 2025
58375ce
Merge branch 'master' into fa/fixclassicallpcode
Fe-r-oz Sep 1, 2025
c8ad9d7
Merge branch 'master' into fa/fixclassicallpcode
Fe-r-oz Oct 9, 2025
fa64869
Merge branch 'master' into fa/fixclassicallpcode
Fe-r-oz Oct 28, 2025
52e531b
Merge branch 'master' into fa/fixclassicallpcode
Fe-r-oz Oct 30, 2025
e9fd581
polish
Fe-r-oz Oct 30, 2025
a574142
polish
Fe-r-oz Oct 30, 2025
8bacf0f
add LiftedCode to the CECC tests
Fe-r-oz Oct 30, 2025
0582ce5
add degree
Fe-r-oz Oct 30, 2025
e76180c
add gcd
Fe-r-oz Oct 30, 2025
1e7d4f4
polish 2
Fe-r-oz Oct 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

## v0.10.0 - 2025-06-25

- **(fix)** The `parity_checks`, `code_n`, and `code_s` methods were throwing method errors and `code_k` was not defined for the classical `LiftedCode`s.
- **(fix)** The gates `SQRTY`, `CXYZ`, `CZYX` were computing phases incorrectly when acting on `I` stabilizers.
- **(fix)** Paulis with imaginary phases had their phases incorrectly tracked.
- **(fix)** `rowdecompose` was not accounting for the phase of the input Pauli string, leading to potential errors in non-Clifford functionality.
Expand Down
12 changes: 7 additions & 5 deletions ext/QuantumCliffordHeckeExt/QuantumCliffordHeckeExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ using QECCore
import QECCore: code_n, code_s, code_k, rate, distance
using DocStringExtensions

import QuantumClifford, LinearAlgebra
import QuantumClifford
import LinearAlgebra
import LinearAlgebra: rank
import Hecke: Group, GroupElem, AdditiveGroupElem,
GroupAlgebra, GroupAlgebraElem, FqFieldElem, representation_matrix, dim, base_ring,
multiplication_table, coefficients, abelian_group, group_algebra, rand
multiplication_table, coefficients, abelian_group, group_algebra, rand, order, group
import Nemo
import Nemo: characteristic, matrix_repr, GF, ZZ, lift
import Nemo: characteristic, matrix_repr, GF, ZZ, lift, matrix

import QuantumClifford.ECC: iscss, parity_checks,
import QuantumClifford.ECC: iscss, parity_checks, parity_matrix,
two_block_group_algebra_codes, generalized_bicycle_codes, bicycle_codes, check_repr_commutation_relation,
haah_cubic_codes

import QECCore: AbstractECC, CSS,
hgp, code_k, code_n, code_s, parity_matrix_x, parity_matrix_z, parity_matrix_xz
hgp, code_k, code_n, code_s, parity_matrix_x, parity_matrix_z, parity_matrix_xz, parity_matrix

# exported from extension so that Documenter.jl sees them when autogenerating API lists
export hgp, two_block_group_algebra_codes, generalized_bicycle_codes, bicycle_codes, haah_cubic_codes,
Expand Down
81 changes: 75 additions & 6 deletions ext/QuantumCliffordHeckeExt/lifted.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,44 @@ function LiftedCode(A::Matrix{GroupAlgebraElem{FqFieldElem, <: GroupAlgebra}}; G
LiftedCode(A; GA=GA, repr=representation_matrix)
end

# TODO document and doctest example
"""
Constructs a group algebra code by embedding a matrix of group elements into the
specified group algebra `GA`, with optional custom representation `repr`.

# Example

```jldoctest
julia> import Hecke: group_algebra, GF, abelian_group, gens, representation_matrix

julia> import QuantumClifford.ECC: LiftedCode, code_n, code_k, code_s

julia> import QuantumClifford.ECC.QECCore: parity_matrix

julia> l = 12; GA = group_algebra(GF(2), abelian_group(l)); x = gens(GA)[];

julia> B = reshape([1 + x + x^3 + x^6], (1, 1));

julia> c = LiftedCode(B, repr = representation_matrix);

julia> code = parity_matrix(c)
12×12 Matrix{Bool}:
1 0 0 0 0 0 1 0 0 1 0 1
1 1 0 0 0 0 0 1 0 0 1 0
0 1 1 0 0 0 0 0 1 0 0 1
1 0 1 1 0 0 0 0 0 1 0 0
0 1 0 1 1 0 0 0 0 0 1 0
0 0 1 0 1 1 0 0 0 0 0 1
1 0 0 1 0 1 1 0 0 0 0 0
0 1 0 0 1 0 1 1 0 0 0 0
0 0 1 0 0 1 0 1 1 0 0 0
0 0 0 1 0 0 1 0 1 1 0 0
0 0 0 0 1 0 0 1 0 1 1 0
0 0 0 0 0 1 0 0 1 0 1 1

julia> code_n(c), code_k(c), code_s(c)
(12, 3, 12)
```
"""
function LiftedCode(group_elem_array::Matrix{<: GroupOrAdditiveGroupElem}; GA::GroupAlgebra=group_algebra(GF(2), parent(group_elem_array[1,1])), repr::Union{Function, Nothing}=nothing)
A = zeros(GA, size(group_elem_array)...)
for i in axes(group_elem_array, 1), j in axes(group_elem_array, 2)
Expand All @@ -83,7 +120,37 @@ function LiftedCode(group_elem_array::Matrix{<: GroupOrAdditiveGroupElem}; GA::G
end
end

# TODO document and doctest example
"""
Constructs a group algebra code over `GF(2)` by lifting a matrix of cyclic shifts
(entries modulo `l`) to the group algebra of the abelian group `ℤ/lℤ` of order `l`.

# Example

```jldoctest
julia> import Hecke; import QuantumClifford.ECC: LiftedCode, code_n, code_k, code_s

julia> import QuantumClifford.ECC.QECCore: parity_matrix

julia> base_matrix = [0 0 0 0; 0 1 2 5; 0 6 3 1]; l = 3;

julia> c = LiftedCode(base_matrix, l);

julia> code = parity_matrix(c)
9×12 Matrix{Bool}:
1 0 0 1 0 0 1 0 0 1 0 0
0 1 0 0 1 0 0 1 0 0 1 0
0 0 1 0 0 1 0 0 1 0 0 1
1 0 0 0 0 1 0 1 0 0 1 0
0 1 0 1 0 0 0 0 1 0 0 1
0 0 1 0 1 0 1 0 0 1 0 0
1 0 0 1 0 0 1 0 0 0 0 1
0 1 0 0 1 0 0 1 0 1 0 0
0 0 1 0 0 1 0 0 1 0 1 0

julia> code_n(c), code_k(c), code_s(c)
(12, 5, 9)
```
"""
function LiftedCode(shift_array::Matrix{Int}, l::Int; GA::GroupAlgebra=group_algebra(GF(2), abelian_group(l)))
A = zeros(GA, size(shift_array)...)
for i in 1:size(shift_array, 1)
Expand All @@ -103,10 +170,12 @@ function concat_lift_repr(repr, mat)
return z
end

function parity_checks(c::LiftedCode)
return lift(c.repr, c.A)
function parity_matrix(c::LiftedCode)
return concat_lift_repr(c.repr, c.A)
end

code_n(c::LiftedCode) = size(c.A, 2) * size(zero(c.GA), 2)
code_n(c::LiftedCode) = size(c.A, 2) * order(group(c.GA))

code_s(c::LiftedCode) = size(c.A, 1) * order(group(c.GA))

code_s(c::LiftedCode) = size(c.A, 1) * size(zero(c.GA), 1)
code_k(c::LiftedCode) = code_n(c) - rank(matrix(GF(2), parity_matrix(c)))
2 changes: 1 addition & 1 deletion src/ecc/ECC.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module ECC

using QECCore
import QECCore: code_n, code_s, code_k, rate, distance, parity_matrix_x, parity_matrix_z,parity_matrix
import QECCore: code_n, code_s, code_k, rate, distance, parity_matrix_x, parity_matrix_z, parity_matrix
using LinearAlgebra: LinearAlgebra, I, rank, tr
using QuantumClifford: QuantumClifford, AbstractOperation, AbstractStabilizer,
AbstractTwoQubitOperator, Stabilizer, PauliOperator,
Expand Down
Loading