Skip to content

Commit

Permalink
improve error handling for LP code Bicycle and GB constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
Fe-r-oz committed Sep 29, 2024
1 parent 4e06c01 commit 159357d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ext/QuantumCliffordHeckeExt/lifted_product.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ julia> code_n(c), code_k(c)
""" # TODO doctest example
function generalized_bicycle_codes(a_shifts::Array{Int}, b_shifts::Array{Int}, l::Int)
GA = group_algebra(GF(2), abelian_group(l))
!(all(a_shifts .>= 0) && all(a_shifts .< dim(GA))) && throw(DimensionMismatch("Each element in $a_shifts must ≥ 0 and < the order of Group Algebra $(dim(GA))"))
!(all(b_shifts .>= 0) && all(b_shifts .< dim(GA))) && throw(DimensionMismatch("Each element in $b_shifts must ≥ 0 and < the order of Group Algebra $(dim(GA))"))
a = sum(GA[n%l+1] for n in a_shifts)
b = sum(GA[n%l+1] for n in b_shifts)
two_block_group_algebra_codes(a, b)
Expand All @@ -182,6 +184,7 @@ See also: [`two_block_group_algebra_codes`](@ref), [`generalized_bicycle_codes`]
""" # TODO doctest example
function bicycle_codes(a_shifts::Array{Int}, l::Int)
GA = group_algebra(GF(2), abelian_group(l))
!(all(a_shifts .>= 0) && all(a_shifts .< dim(GA))) && throw(DimensionMismatch("Each element in $a_shifts must ≥ 0 and < the order of Group Algebra $(dim(GA))"))
a = sum(GA[n÷l+1] for n in a_shifts)
two_block_group_algebra_codes(a, a')
end

0 comments on commit 159357d

Please sign in to comment.