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.LinearCodeType
LinearCode(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.

source

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.fieldFunction
field(C::AbstractLinearCode)

Return the base ring of the generator matrix.

source
field(S::AbstractSubsystemCode)

Return the base ring of the code.

source
Base.lengthFunction
length(C::AbstractLinearCode)

Return the length of the code.

source
length(S::AbstractSubsystemCode)
num_qubits(S::AbstractSubsystemCode)

Return the length of the code.

source
Hecke.dimensionFunction
dimension(C::AbstractLinearCode)

Return the dimension of the code.

source
dimension(S::AbstractSubsystemCode)

Return the dimension of the code.

source
CodingTheory.cardinalityFunction
cardinality(C::AbstractLinearCode)

Return the cardinality of the code.

source
cardinality(S::AbstractSubsystemCode)

Return the cardinality of the stabilizer group of the code.

source
CodingTheory.rateFunction
rate(C::AbstractLinearCode)

Return the rate, $R = k/n$, of the code.

source
rate(S::AbstractSubsystemCode)

Return the rate, R = k/n, of the code.

source

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_matrixFunction
generator_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.

source
CodingTheory.parity_check_matrixFunction
parity_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.

source
CodingTheory.is_overcompleteFunction
is_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.

source
is_overcomplete(S::AbstractSubsystemCode)

Return true if S has an overcomplete set of stabilizers.

source

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_permutationFunction
standard_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.

source
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.

source

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

If the minimum distance of the code is known, the following functions return useful properties; otherwise they return missing.

CodingTheory.relative_distanceFunction
relative_distance(C::AbstractLinearCode)

Return the relative minimum distance, $\delta = d / n$ of the code if $d$ is known; otherwise return missing.

source
relative_distance(S::AbstractSubsystemCode)

Return the relative minimum distance, δ = d / n of the code if d is known, otherwise errors.

source
Hecke.genusFunction
genus(C::AbstractLinearCode)

Return the genus, $n + 1 - k - d$, of the code.

source
CodingTheory.number_correctable_errorsFunction
number_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}$.
source

The minimum distance and its bounds may be manually set as well. Nothing is done to check this value for correctness.

Missing docstring.

Missing docstring for set_distance_upper_bound!. Check Documenter's build log for details.

CodingTheory.set_minimum_distance!Function
set_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$.
source
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 that 1 ≤ d ≤ n.
source

Methods

CodingTheory.Singleton_boundFunction
Singleton_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.

source
Singleton_bound(C::AbstractLinearCode)

Return the Singleton bound on the minimum distance of the code ($d \leq n - k + 1$).

source
Missing docstring.

Missing docstring for encode. Check Documenter's build log for details.

CodingTheory.syndromeFunction
syndrome(C::AbstractLinearCode, v::Union{CTMatrixTypes, Vector{Int}})

Return the syndrome of v with respect to C.

source
syndrome(S::AbstractSubsystemCode, v::CTMatrixTypes)

Return the syndrome of the vector v with respect to the stabilizers of S.

source
Base.inFunction
in(v::Union{CTMatrixTypes, Vector{Int}}, C::AbstractLinearCode)

Return whether or not v is a codeword of C.

source
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.

source
⊆(C1::AbstractCyclicCode, C2::AbstractCyclicCode)
⊂(C1::AbstractCyclicCode, C2::AbstractCyclicCode)
is_subcode(C1::AbstractCyclicCode, C2::AbstractCyclicCode)

Return whether or not C1 is a subcode of C2.

source
CodingTheory.are_equivalentFunction
are_equivalent(C1::AbstractLinearCode, C2::AbstractLinearCode)

Return true if C1 ⊆ C2 and C2 ⊆ C1.

source
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 and S2 are permutation equivalent.
source
Hecke.dualFunction
dual(C::AbstractLinearCode)
Euclidean_dual(C::AbstractLinearCode)

Return the (Euclidean) dual of the code C.

source
CodingTheory.is_self_dualFunction
is_self_dual(C::AbstractLinearCode)

Return true if are_equivalent(C, dual(C)).

source
is_self_dual(C::AbstractCyclicCode)

Return whether or not C == dual(C).

source
CodingTheory.is_self_orthogonalFunction
is_self_orthogonal(C::AbstractLinearCode)
is_weakly_self_dual(C::AbstractLinearCode)
is_Euclidean_self_orthogonal(C::AbstractLinearCode)

Return true if C ⊆ dual(C).

source
CodingTheory.hullFunction
hull(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.
source
CodingTheory.is_LCDFunction
is_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.
source
CodingTheory.Hermitian_hullFunction
Hermitian_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.
source
CodingTheory.is_Hermitian_LCDFunction
is_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.
source
CodingTheory.wordsFunction
words(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 is true, the elements are only printed to the console and not returned.
source