Cyclic Codes
Cyclic codes are a subtype of LinearCode
and inherit its methods. For more information on how to use these functions, see the cyclic code tutorial.
Cyclotomic Cosets
The following set of functions are useful for defining cyclic codes.
CodingTheory.ord
— Functionord(n::Int, q::Int)
Return the order of n
mod q
.
CodingTheory.cyclotomic_coset
— Functioncyclotomic_coset(x::Int, q::Int, n::Int, to_sort::Bool=true, verbose::Bool=false)
Return the q
-cyclotomic coset of x
modulo n
.
Notes
- If the optional parameter
to_sort
is set tofalse
, the result will not be
sorted. If the optional parameter verbose
is set to true
, the result will pretty print.
CodingTheory.all_cyclotomic_cosets
— Functionall_cyclotomic_cosets(q::Int, n::Int, to_sort::Bool=true, verbose::Bool=false)
Return all q
-cyclotomic cosets modulo n
.
Notes
- If the optional parameter
to_sort
is set tofalse
, the result will not be
sorted. If the optional parameter verbose
is set to true
, the result will pretty print.
CodingTheory.complement_qcosets
— Functioncomplement_qcosets(q::Int, n::Int, qcosets::Vector{Vector{Int64}})
Return the complement of the q
-cyclotomic cosets modulo n
of qcosets
.
CodingTheory.qcoset_pairings
— Functionqcoset_pairings(arr::Vector{Vector{Int64}}, n::Int)
Return the q
-cyclotomic cosets modulo n
collected into complementary pairs.
Missing docstring for qcoset_table
. Check Documenter's build log for details.
CodingTheory.dual_qcosets
— Functiondual_qcosets(q::Int, n::Int, qcosets::Vector{Vector{Int64}})
Return the dual of the q
-cyclotomic cosets modulo n
of qcosets
.
Constructors
CodingTheory.CyclicCode
— TypeCyclicCode(q::Int, n::Int, cosets::Vector{Vector{Int}})
Return the CyclicCode of length n
over GF(q)
with q
-cyclotomic cosets cosets
.
Notes
- This function will auto determine if the constructed code is BCH or Reed-Solomon
and call the appropriate constructor.
Examples
julia> q = 2; n = 15; b = 3; δ = 4;
julia> cosets = defining_set([i for i = b:(b + δ - 2)], q, n, false);
julia> C = CyclicCode(q, n, cosets)
CyclicCode(n::Int, g::fq_nmod_poly)
Return the length n
cyclic code generated by the polynomial g
.
CodingTheory.BCHCode
— TypeBCHCode(q::Int, n::Int, δ::Int, b::Int=0)
Return the BCHCode of length n
over GF(q)
with design distance δ
and offset b
.
Notes
- This function will auto determine if the constructed code is Reed-Solomon
and call the appropriate constructor.
Examples
julia> q = 2; n = 15; b = 3; δ = 4;
julia> B = BCHCode(q, n, δ, b)
[15, 5, ≥7; 1]_2 BCH code over splitting field GF(16).
2-Cyclotomic cosets:
C_1 ∪ C_3 ∪ C_5
Generator polynomial:
x^10 + x^8 + x^5 + x^4 + x^2 + x + 1
Generator matrix: 5 × 15
1 1 1 0 1 1 0 0 1 0 1 0 0 0 0
0 1 1 1 0 1 1 0 0 1 0 1 0 0 0
0 0 1 1 1 0 1 1 0 0 1 0 1 0 0
0 0 0 1 1 1 0 1 1 0 0 1 0 1 0
0 0 0 0 1 1 1 0 1 1 0 0 1 0 1
BCHCode(C::AbstractCyclicCode)
Return the BCH supercode of the cyclic code C
.
CodingTheory.ReedSolomonCode
— TypeReedSolomonCode(q::Int, δ::Int, b::Int=0)
Return the ReedSolomonCode over GF(q)
with distance d
and offset b
.
Examples
julia> ReedSolomonCode(8, 3, 0)
[7, 5, ≥3; 0]_8 Reed Solomon code.
8-Cyclotomic cosets:
C_0 ∪ C_1
Generator polynomial:
x^2 + (α + 1)*x + α
Generator matrix: 5 × 7
α α + 1 1 0 0 0 0
0 α α + 1 1 0 0 0
0 0 α α + 1 1 0 0
0 0 0 α α + 1 1 0
0 0 0 0 α α + 1 1
julia> ReedSolomonCode(13, 5, 1)
[12, 8, ≥5; 1]_13 Reed Solomon code.
13-Cyclotomic cosets:
C_1 ∪ C_2 ∪ C_3 ∪ C_4
Generator polynomial:
x^4 + 9*x^3 + 7*x^2 + 2*x + 10
Generator matrix: 8 × 12
10 2 7 9 1 0 0 0 0 0 0 0
0 10 2 7 9 1 0 0 0 0 0 0
0 0 10 2 7 9 1 0 0 0 0 0
0 0 0 10 2 7 9 1 0 0 0 0
0 0 0 0 10 2 7 9 1 0 0 0
0 0 0 0 0 10 2 7 9 1 0 0
0 0 0 0 0 0 10 2 7 9 1 0
0 0 0 0 0 0 0 10 2 7 9 1
CodingTheory.QuadraticResidueCode
— FunctionQuadraticResidueCode(q::Int, n::Int)
Return the cyclic code whose roots are the quadratic residues of q
, n
.
Attributes
CodingTheory.splitting_field
— Functionsplitting_field(C::AbstractCyclicCode)
Return the splitting field of the generator polynomial.
AbstractAlgebra.polynomial_ring
— Functionpolynomial_ring(C::AbstractCyclicCode)
Return the polynomial ring of the generator polynomial.
CodingTheory.primitive_root
— Functionprimitive_root(C::AbstractCyclicCode)
Return the primitive root of the splitting field.
CodingTheory.offset
— Functionoffset(C::AbstractBCHCode)
Return the offset of the BCH code.
CodingTheory.design_distance
— Functiondesign_distance(C::AbstractBCHCode)
Return the design distance of the BCH code.
CodingTheory.qcosets
— Functionqcosets(C::AbstractCyclicCode)
Return the q-cyclotomic cosets of the cyclic code.
CodingTheory.qcosets_reps
— Functionqcosets_reps(C::AbstractCyclicCode)
Return the set of representatives for the q-cyclotomic cosets of the cyclic code.
CodingTheory.defining_set
— Functiondefining_set(C::AbstractCyclicCode)
Return the defining set of the cyclic code.
defining_set(nums::Vector{Int}, q::Int, n::Int, flat::Bool=true)
Returns the set of q
-cyclotomic cosets of the numbers in nums
modulo n
.
Notes
- If
flat
is set to true, the result will be a single flattened and sorted array.
Base.zeros
— Functionzeros(C::AbstractCyclicCode)
Return the zeros of C
.
CodingTheory.nonzeros
— Functionnonzeros(C::AbstractCyclicCode)
Return the nonzeros of C
.
CodingTheory.generator_polynomial
— Functiongenerator_polynomial(C::AbstractCyclicCode)
Return the generator polynomial of the cyclic code.
CodingTheory.parity_check_polynomial
— Functionparity_check_polynomial(C::AbstractCyclicCode)
Return the parity-check polynomial of the cyclic code.
CodingTheory.idempotent
— Functionidempotent(C::AbstractCyclicCode)
Return the idempotent (polynomial) of the cyclic code.
Missing docstring for BCH_bound
. Check Documenter's build log for details.
CodingTheory.is_narrowsense
— Functionis_narrow_sense(C::AbstractBCHCode)
Return true
if the BCH code is narrowsense.
CodingTheory.is_reversible
— Functionis_reversible(C::AbstractCyclicCode)
Return true
if the cyclic code is reversible.
CodingTheory.is_degenerate
— Functionis_degenerate(C::AbstractCyclicCode)
Return true
if the cyclic code is degenerate.
Notes
- A cyclic code is degenerate if the parity-check polynomial divides
x^r - 1
for
some r
less than the length of the code.
Hecke.is_primitive
— Functionis_primitive(C::AbstractBCHCode)
Return true
if the BCH code is primitive.
CodingTheory.is_antiprimitive
— Functionis_antiprimitive(C::AbstractBCHCode)
Return true
if the BCH code is antiprimitive.
Methods
Missing docstring for defining_set
. Check Documenter's build log for details.
CodingTheory.dual_defining_set
— Functiondual_defining_set(def_set::Vector{Int}, n::Int)
Return the defining set of the dual code of length n
and defining set def_set
.
CodingTheory.is_cyclic
— Functionis_cyclic(C::AbstractLinearCode)
Return true
and the equivalent cyclic code object if C
is a cyclic code; otherwise, return false, missing
.
Oscar.complement
— Functioncomplement(C::AbstractCyclicCode)
Return the cyclic code whose cyclotomic cosets are the completement of C
's.
Base.:∩
— Function∩(C1::AbstractCyclicCode, C2::AbstractCyclicCode)
Return the intersection code of C1
and C2
.
Base.:+
— Function+(C1::AbstractCyclicCode, C2::AbstractCyclicCode)
Return the addition code of C1
and C2
.