Linear Codes
Constructors
Generic linear codes may be constructed in two ways: via a matrix or via a vector space object. If a vector space is used, the basis of the vector space is used as a generator matrix for the code. If the optional parameter parity
is set to true, the input is considered a parity-check matrix instead of a generator matrix. At the moment, no convention is used for the zero code and an error is thrown for such imputs. Zero rows are automatically removed from the input but zero columns are not. See the tutorials for usage examples.
CodingTheory.LinearCode
— TypeLinearCode(G::CTMatrixTypes, parity::Bool=false, brute_force_WE::Bool=true)
Return the linear code constructed with generator matrix G
. If the optional paramater parity
is set to true
, a linear code is built with G
as the parity-check matrix. If the optional parameter brute_force_WE
is true
, the weight enumerator and (and therefore the distance) is calculated when there are fewer than 1.5e5 codewords.
Attributes
Various getter/accessor functions are provided for accessing attributes about the codes. The user is strongly encouraged to use these functions and never to work with the underlying structs directly, as many functions rely on the information in the structs to be in a specific order and don't check if information has been updated.
CodingTheory.field
— Functionfield(C::AbstractLinearCode)
Return the base ring of the generator matrix.
field(S::AbstractSubsystemCode)
Return the base ring of the code.
Base.length
— Functionlength(C::AbstractLinearCode)
Return the length of the code.
length(S::AbstractSubsystemCode)
num_qubits(S::AbstractSubsystemCode)
Return the length of the code.
Hecke.dimension
— Functiondimension(C::AbstractLinearCode)
Return the dimension of the code.
dimension(S::AbstractSubsystemCode)
Return the dimension of the code.
CodingTheory.cardinality
— Functioncardinality(C::AbstractLinearCode)
Return the cardinality of the code.
cardinality(S::AbstractSubsystemCode)
Return the cardinality of the stabilizer group of the code.
CodingTheory.rate
— Functionrate(C::AbstractLinearCode)
Return the rate, $R = k/n$, of the code.
rate(S::AbstractSubsystemCode)
Return the rate, R = k/n
, of the code.
If the linear code was created by passing in a generator (parity-check) matrix, then this matrix is stored in addition to the standard form. Note that this matrix is potentially over complete (has more rows than its rank). The standard form is returned when the optional parameter stand_form
is set to true. Some code families are not constructed using these matrices. In these cases, the matrices are initially missing
and are computed and cached when these functions are called for the first time. Direct access to the underlying structs is not recommended.
Oscar.generator_matrix
— Functiongenerator_matrix(C::AbstractLinearCode, stand_form::Bool=false)
Return the generator matrix of the code. If the optional parameter stand_form
is set to true
, the standard form of the generator matrix is returned instead.
CodingTheory.parity_check_matrix
— Functionparity_check_matrix(C::AbstractLinearCode, stand_form::Bool=false)
Return the parity-check matrix of the code. If the optional parameter stand_form
is set to true
, the standard form of the parity-check matrix is returned instead.
CodingTheory.is_overcomplete
— Functionis_overcomplete(C::AbstractLinearCode, which::Symbol=:G)
Return true
if the generator matrix is over complete, or if the optional parameter is set to :H and the parity-check matrix is over complete.
is_overcomplete(S::AbstractSubsystemCode)
Return true
if S
has an overcomplete set of stabilizers.
Recall that putting the matrix into standard form may require column permutations. If this is the case, the column permutation matrix $P$ such that $\mathrm{rowspace}(G) = \mathrm{rowspace}(G_\mathrm{stand} * P)$ may be accessed using the following function. If no column permutations are required, this returns missing
.
CodingTheory.standard_form_permutation
— Functionstandard_form_permutation(C::AbstractLinearCode)
Return the permutation matrix required to permute the columns of the code mAtrices to have the same row space as the mAtrices in standard form. Returns missing
is no such permutation is required.
standard_form_permutation(S::AbstractSubsystemCode)
Return the permutation matrix required to permute the columns of the code matrices to have the same row space as the matrices in standard form. Returns missing
is no such permutation is required.
The minimum distance of some code families are known and are set during construction. The minimum distance is automatically computed in the constructor for codes which are deemed "small enough". Otherwise, the minimum distance is missing
. Primitive bounds on the minimum distance are given by
CodingTheory.minimum_distance_lower_bound
— Functionminimum_distance_lower_bound(C::AbstractLinearCode)
Return the current lower bound on the minimum distance of C
.
CodingTheory.minimum_distance_upper_bound
— Functionminimum_distance_upper_bound(C::AbstractLinearCode)
Return the current upper bound on the minimum distance of C
.
If the minimum distance of the code is known, the following functions return useful properties; otherwise they return missing
.
CodingTheory.relative_distance
— Functionrelative_distance(C::AbstractLinearCode)
Return the relative minimum distance, $\delta = d / n$ of the code if $d$ is known; otherwise return missing
.
relative_distance(S::AbstractSubsystemCode)
Return the relative minimum distance, δ = d / n
of the code if d
is known, otherwise errors.
Hecke.genus
— Functiongenus(C::AbstractLinearCode)
Return the genus, $n + 1 - k - d$, of the code.
CodingTheory.is_MDS
— Functionis_MDS(C::AbstractLinearCode)
Return true
if code is maximum distance separable (MDS).
CodingTheory.number_correctable_errors
— Functionnumber_correctable_errors(C::AbstractLinearCode)
Return the number of correctable errors for the code.
Notes
- The number of correctable errors is $t = \floor{(d - 1) / 2}$.
The minimum distance and its bounds may be manually set as well. Nothing is done to check this value for correctness.
CodingTheory.set_distance_lower_bound!
— Functionset_distance_lower_bound!(C::AbstractLinearCode, l::Int)
Set the lower bound on the minimum distance of C
, if l
is better than the current bound.
Missing docstring for set_distance_upper_bound!
. Check Documenter's build log for details.
CodingTheory.set_minimum_distance!
— Functionset_minimum_distance!(C::AbstractLinearCode, d::Int)
Set the minimum distance of the code to d
.
Notes
- The only check done on the value of
d
is that $1 \leq d \leq n$.
set_minimum_distance!(S::AbstractSubsystemCode, d::Int)
Set the minimum distance of the code to d
.
Notes
- The only check done on the value of
d
is that1 ≤ d ≤ n
.
Methods
CodingTheory.Singleton_bound
— FunctionSingleton_bound(n::Int, a::Int)
Return the Singleton bound $d \leq n - k + 1$ or $k \leq n - d + 1$ depending on the interpretation of a
.
Singleton_bound(C::AbstractLinearCode)
Return the Singleton bound on the minimum distance of the code ($d \leq n - k + 1$).
Missing docstring for encode
. Check Documenter's build log for details.
CodingTheory.syndrome
— Functionsyndrome(C::AbstractLinearCode, v::Union{CTMatrixTypes, Vector{Int}})
Return the syndrome of v
with respect to C
.
syndrome(S::AbstractSubsystemCode, v::CTMatrixTypes)
Return the syndrome of the vector v
with respect to the stabilizers of S
.
Base.in
— Functionin(v::Union{CTMatrixTypes, Vector{Int}}, C::AbstractLinearCode)
Return whether or not v
is a codeword of C
.
Base.:⊆
— Function⊆(C1::AbstractLinearCode, C2::AbstractLinearCode)
⊂(C1::AbstractLinearCode, C2::AbstractLinearCode)
is_subcode(C1::AbstractLinearCode, C2::AbstractLinearCode)
Return whether or not C1
is a subcode of C2
.
⊆(C1::AbstractCyclicCode, C2::AbstractCyclicCode)
⊂(C1::AbstractCyclicCode, C2::AbstractCyclicCode)
is_subcode(C1::AbstractCyclicCode, C2::AbstractCyclicCode)
Return whether or not C1
is a subcode of C2
.
CodingTheory.are_equivalent
— Functionare_equivalent(C1::AbstractLinearCode, C2::AbstractLinearCode)
Return true
if C1 ⊆ C2
and C2 ⊆ C1
.
are_equivalent(S1::T, S2::T) where T <: AbstractSubsystemCode
Return true
if the codes are equivalent as symplectic vector spaces.
Note
- This is not intended to detect if
S1
andS2
are permutation equivalent.
Hecke.dual
— Functiondual(C::AbstractLinearCode)
Euclidean_dual(C::AbstractLinearCode)
Return the (Euclidean) dual of the code C
.
CodingTheory.is_self_dual
— Functionis_self_dual(C::AbstractLinearCode)
Return true
if are_equivalent(C, dual(C))
.
is_self_dual(C::AbstractCyclicCode)
Return whether or not C == dual(C)
.
CodingTheory.is_self_orthogonal
— Functionis_self_orthogonal(C::AbstractLinearCode)
is_weakly_self_dual(C::AbstractLinearCode)
is_Euclidean_self_orthogonal(C::AbstractLinearCode)
Return true
if C ⊆ dual(C)
.
CodingTheory.is_dual_containing
— Functionis_dual_containing(C::AbstractLinearCode)
is_Euclidean_dual_containing(C::AbstractLinearCode)
Return true
if dual(C) ⊆ C
.
CodingTheory.hull
— Functionhull(C::AbstractLinearCode)
Euclidean_hull(C::AbstractLinearCode)
Return the (Euclidean) hull of C
and its dimension.
Notes
- The hull of a code is the intersection of it and its dual.
CodingTheory.is_LCD
— Functionis_LCD(C::AbstractLinearCode)
Return true
if C
is linear complementary dual.
Notes
- A code is linear complementary dual if the dimension of
hull(C)
is zero.
CodingTheory.Hermitian_dual
— FunctionHermitian_dual(C::AbstractLinearCode)
Return the Hermitian dual of a code defined over a quadratic extension.
CodingTheory.is_Hermitian_self_dual
— Functionis_Hermitian_self_dual(C::AbstractLinearCode)
Return true
if are_equivalent(C, Hermitian_dual(C))
.
CodingTheory.is_Hermitian_self_orthogonal
— Functionis_Hermitian_self_orthogonal(C::AbstractLinearCode)
is_Hermitian_weakly_self_dual(C::AbstractLinearCode)
Return true
if C ⊆ Hermitian_dual(C)
.
CodingTheory.is_Hermitian_dual_containing
— Functionis_Hermitian_dual_containing(C::AbstractLinearCode)
Return true
if Hermitian_dual(C) ⊆ C
.
CodingTheory.Hermitian_hull
— FunctionHermitian_hull::AbstractLinearCode)
Return the Hermitian hull of C
and its dimension.
Notes
- The Hermitian hull of a code is the intersection of it and its Hermitian dual.
CodingTheory.is_Hermitian_LCD
— Functionis_Hermitian_LCD(C::AbstractLinearCode)
Return true
if C
is linear complementary Hermitian dual.
Notes
- A code is linear complementary Hermitian dual if the dimension of
Hermitian_hull(C)
is zero.
CodingTheory.is_even
— Functionis_even(C::AbstractLinearCode)
Return true
if C
is even.
CodingTheory.is_doubly_even
— Functionis_doubly_even(C::AbstractLinearCode)
Return true
if C
is doubly-even.
CodingTheory.is_triply_even
— Functionis_triply_even(C::AbstractLinearCode)
Return true
if C
is triply-even.
CodingTheory.characteristic_polynomial
— Functioncharacteristic_polynomial(C::AbstractLinearCode)
Return the characteristic polynomial of C
.
Notes
- The characteristic polynomial is defined in [Lin1999]_
AbstractAlgebra.VectorSpace
— FunctionVectorSpace(C::AbstractLinearCode)
vector_space(C::AbstractLinearCode)
Return the code C
as a vector space object.
CodingTheory.words
— Functionwords(C::AbstractLinearCode, only_print::Bool=false)
codewords(C::AbstractLinearCode, only_print::Bool=false)
elements(C::AbstractLinearCode, only_print::Bool=false)
Return the elements of C
.
Notes
- If
only_print
istrue
, the elements are only printed to the console and not returned.