From 332333a39ec16d3ef89e6a442c90d5cf6b291015 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Tue, 5 Nov 2024 10:13:33 +0000 Subject: [PATCH] build based on c65c5d8 --- dev/.documenter-siteinfo.json | 2 +- dev/index.html | 118 +++++++++++++--------------------- 2 files changed, 44 insertions(+), 76 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index d941a94..0399288 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-05T08:32:24","documenter_version":"1.7.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-05T10:13:29","documenter_version":"1.7.0"}} \ No newline at end of file diff --git a/dev/index.html b/dev/index.html index 314b7d9..fc91974 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,82 +1,50 @@ Index · CodingTheory Documentation

CodingTheory.jl Documentation

Adding CodingTheory.jl

julia> using Pkg
julia> Pkg.add("CodingTheory") Updating registry at `~/.julia/registries/General.toml` Resolving package versions... - Installed OffsetArrays ─ v1.14.1 - Installed CodingTheory ─ v0.2.2 - Installed Polynomials ── v1.2.1 - Updating `~/work/CodingTheory.jl/CodingTheory.jl/docs/Project.toml` - [89c41d41] ~ CodingTheory v0.2.3 `~/work/CodingTheory.jl/CodingTheory.jl` ⇒ v0.2.2 - Updating `~/work/CodingTheory.jl/CodingTheory.jl/docs/Manifest.toml` - [c3fe647b] - AbstractAlgebra v0.24.1 - [89c41d41] ~ CodingTheory v0.2.3 `~/work/CodingTheory.jl/CodingTheory.jl` ⇒ v0.2.2 - [d5909c97] - GroupsCore v0.4.2 - [3e1990a7] - Hecke v0.10.29 - [d8a4904e] - MutableArithmetics v1.5.2 - [2edaba10] - Nemo v0.29.2 - [6fe1bfb0] + OffsetArrays v1.14.1 -⌅ [f27b6e38] ↓ Polynomials v2.0.25 ⇒ v1.2.1 - [fb686558] - RandomExtensions v0.4.4 - [e21ec000] - Antic_jll v0.200.501+0 - [d9960996] - Arb_jll v200.2200.0+0 - [fcfa6d1b] - Calcium_jll v0.400.102+0 - [e134572f] - FLINT_jll v200.800.500+0 - [656ef2d0] - OpenBLAS32_jll v0.3.28+3 - [9abbd945] - Profile v1.11.0 - [781609d7] - GMP_jll v6.3.0+0 - [3a97d323] - MPFR_jll v4.2.1+0 - Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m` -Precompiling project... - 1600.9 ms ✓ OffsetArrays - 2730.7 ms ✓ Polynomials - 2696.2 ms ✓ CodingTheory - 3 dependencies successfully precompiled in 8 seconds. 114 already precompiled. - 2 dependencies precompiled but different versions are currently loaded. Restart julia to access the new versions - 1 dependency had output during precompilation: -┌ Polynomials -│ WARNING: method definition for showterm at /home/runner/.julia/packages/Polynomials/1aa8e/src/polynomials/ChebyshevT.jl:224 declares type variable N but does not use it. -└

Documentation

CodingTheory.AlphabetType
struct Alphabet <: AbstractCode

Has the parameter Σ, which is the alphabet; a collection of strings, characters, symbols, or Ints.


Alphabet(Σ::AbstractArray)

A constructor method for the struct Alphabet. Takes an array of letters in the alphabet, and attempts to parse them as 64-bit Ints.


Alphabet{N}(Σ::AbstractArray)
-Alphabet{N}(Σ::AbstractString)

A constructor method for the struct Alphabet. Takes in a symbols and splits it into constituent characters. Those symbols are the letters in the alphabet. N is the number of letters in the alphabet

source
CodingTheory.CodeUniverseType
struct CodeUniverse <: AbstractCode

Defines a structure for the messages in the code. Parameters are the abstract array of messages 𝒰, and the length of the messages n.

CodeUniverse(𝒰::AbstractArray, Σ::Alphabet)

An inner constructor function on the structure CodeUniverse.

source
CodingTheory.CodeUniverseIteratorType
struct CodeUniverseIterator <: AbstractCode

A structure used to iterate through a code universe, with specified universe parameters. E.g.,

for c in CodeUniverseIterator(["a", "b", "c"], 3)
+  No Changes to `~/work/CodingTheory.jl/CodingTheory.jl/docs/Project.toml`
+  No Changes to `~/work/CodingTheory.jl/CodingTheory.jl/docs/Manifest.toml`

Documentation

CodingTheory.AlphabetType
struct Alphabet <: AbstractCode

Has the parameter Σ, which is the alphabet; a collection of strings, characters, symbols, or Ints.


Alphabet(Σ::AbstractArray)

A constructor method for the struct Alphabet. Takes an array of letters in the alphabet, and attempts to parse them as 64-bit Ints.


Alphabet{N}(Σ::AbstractArray)
+Alphabet{N}(Σ::AbstractString)

A constructor method for the struct Alphabet. Takes in a symbols and splits it into constituent characters. Those symbols are the letters in the alphabet. N is the number of letters in the alphabet

source
CodingTheory.CodeUniverseType
struct CodeUniverse <: AbstractCode

Defines a structure for the messages in the code. Parameters are the abstract array of messages 𝒰, and the length of the messages n.

CodeUniverse(𝒰::AbstractArray, Σ::Alphabet)

An inner constructor function on the structure CodeUniverse.

source
CodingTheory.CodeUniverseIteratorType
struct CodeUniverseIterator <: AbstractCode

A structure used to iterate through a code universe, with specified universe parameters. E.g.,

for c in CodeUniverseIterator(["a", "b", "c"], 3)
     println(c)
 end

Fields:

  • 𝒰::UniverseParameters

Methods:

CodeUniverseIterator(𝒰::UniverseParameters)
 CodeUniverseIterator(Σ::Union{Alphabet, AbstractArray}, q::Int, n::Int)
 CodeUniverseIterator(Σ::Union{Alphabet, AbstractArray}, n::Int)
-CodeUniverseIterator(q::Int, n::Int)
source
CodingTheory.FinitePolynomialType
struct FinitePolynomial <: FiniteField

Has parameters p, which is an abstract polynomial, and n which is the modulus of the field under which the molynomial is defined.


FinitePolynomial(p::AbstractPolynomial, n::Int)

A constructor method for FinitePolynomial. Takes in a polynomial p and a number n, and constructs a polynomial under modulo n.

source
CodingTheory.RoundingType
struct Rounding end

An abstract structure used as a parameter in a non-rounding method of hamming_bound. Use no_round for this; a predefiend variable of the structure Rounding.

source
CodingTheory.UniverseParametersType
struct UniverseParameters <: AbstractCode

Defines a structure for the messages in the code. Parameters are the alphabet Σ, size of alphabet q, and block length n

UniverseParameters(Σ::Alphabet, n::Int)
+CodeUniverseIterator(q::Int, n::Int)
source
CodingTheory.FinitePolynomialType
struct FinitePolynomial <: FiniteField

Has parameters p, which is an abstract polynomial, and n which is the modulus of the field under which the molynomial is defined.


FinitePolynomial(p::AbstractPolynomial, n::Int)

A constructor method for FinitePolynomial. Takes in a polynomial p and a number n, and constructs a polynomial under modulo n.

source
CodingTheory.RoundingType
struct Rounding end

An abstract structure used as a parameter in a non-rounding method of hamming_bound. Use no_round for this; a predefiend variable of the structure Rounding.

source
CodingTheory.UniverseParametersType
struct UniverseParameters <: AbstractCode

Defines a structure for the messages in the code. Parameters are the alphabet Σ, size of alphabet q, and block length n

UniverseParameters(Σ::Alphabet, n::Int)
 UniverseParameters(Σ::AbstractArray, n::Int)
 UniverseParameters(Σ::Alphabet, q::Int, n::Int)
 UniverseParameters(Σ::AbstractArray, q::Int, n::Int)
-UniverseParameters(q::Int, n::Int)

An inner constructor function on the structure UniverseParameters.

source
CodingTheory.WordType
mutable struct Word{N, T}
+UniverseParameters(q::Int, n::Int)

An inner constructor function on the structure UniverseParameters.

source
CodingTheory.WordType
mutable struct Word{N, T}
 Word(w::NTuple{N, T})
 Word(w::AbstractVector{T})
 Word(w::AbstractString)
-Word(i::T...)

A Word is an StaticArrays.MVector which is efficient (like tuple) yet mutable.

source
Polynomials.PolynomialMethod
Polynomial(A::Union{NTuple{N, T}, Vector{T}}, n::Int) -> Polynomial

Constructs a polynomial under modulo n.

Parameters:

  • A::Union{Tuple, AbstractArray}: The polynomial coefficients.
  • n::Int: The modulus of the field.

Returns

  • Polynomial: A polynomial modulo n.
source
Base.gensymMethod
gensym(q::Int) -> Vector{Symbol}

Generates a vector of unique symbols of length q.

source
Base.modMethod
mod(p::Polynomial, n::Int) -> Polynomial

Uses the FinitePolynomial constructor to return a polynomial p under modulus n.

Parameters:

  • p::Polynomial: The input polynomial.
  • n::Int: The modulus of the field.

Returns

  • Polynomial: A polynomial modulo n.
source
Base.randMethod
rand(𝒰::UniverseParameters, C::AbstractArray) -> Tuple

Given universe parameters 𝒰 and a code C, return a tuple including

  • A random word in C;
  • A random letter in the alphabet; and
  • A random index in the block length.
source
CodingTheory._has_identityMethod
_has_identity(M::Matrix, n::Union{T, Base.OneTo{T}, AbstractRange{T}}) where {T <: Integer}

Inner function on has_identity function. Will return a tuple of:

  • Whether or not the matrix has an identity;
  • Where that identity matrix starts; and
  • How big the identity matrix is.
source
CodingTheory.allequalMethod
allequal(A) -> Bool
-allequal(a, b...) -> Bool

Check that all elements in a list are equal to each other.

source
CodingTheory.aredistinctMethod
aredistinct(A) -> Bool
-aredistinct(a, b...) -> Bool

Check that all elements in a list are distinct from every other element in the list.

source
CodingTheory.areequaltoMethod
areequalto(x::Number, A::AbstractArray) -> Bool
-areequalto(x::Number, a, b...) -> Bool

Check that all elements in a list are equal to a given x.

source
CodingTheory.arelessthanMethod
arelessthan(x::Number, A) -> Bool
-arelessthan(x::Number, a, b...) -> Bool

Check that all elements in a list are less than a given x.

source
CodingTheory.code_distance!Method
code_distance!(C::AbstractArray{T}, w::T) -> Int

A wrapper to get the code distance after pushing a word to the code. This directly changes the matrix M. Use code_distance for a non-mutating version of this function.

Parameters:

  • C::AbstractArray: An array of words in the code.
  • w: A word to be appended to C.

Returns:

  • Int: The code distance after adding w to C.
source
CodingTheory.code_distanceMethod
code_distance(C::AbstractArray) -> Int

Finds the distance of the code. That is, given a code C, finds the minimum distance between any two words in the code, which are not the same. (Find the minimum hamming distance in the code for all unique letters).

Parameters:

  • C::AbstractArray: An array of words in the code.

Return:

  • Int: the distance of the code.
source
CodingTheory.code_distanceMethod
code_distance(C::AbstractArray{T}, w::T) -> Int

A wrapper to get the code distance after pushing a word to the code.

Parameters:

  • C::AbstractArray: An array of words in the code.
  • w: A word to be appended to C.

Returns:

  • Int: The code distance after adding w to C.

Examples

julia> code_distance([[0, 0, 0, 0, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 1, 1, 1, 1]]) # gets the minimum distance between two vectors in an array of vectors
-2
source
CodingTheory.construct_ham_matrixMethod
construct_ham_matrix(r::Int, q::Int) -> Matrix

Construct a Hamming parity-check matrix.

Parameters:

  • r::Int: number of rows of a parity check matrix.
  • q:::Int: The size of the alphabet of the code.

Returns:

  • Matrix: The Hamming matrix, denoted as $\text{Ham}(r, q)$

Examples

julia> construct_ham_matrix(3,2)
+Word(i::T...)

A Word is an StaticArrays.MVector which is efficient (like tuple) yet mutable.

source
Polynomials.PolynomialMethod
Polynomial(A::Union{NTuple{N, T}, Vector{T}}, n::Int) -> Polynomial

Constructs a polynomial under modulo n.

Parameters:

  • A::Union{Tuple, AbstractArray}: The polynomial coefficients.
  • n::Int: The modulus of the field.

Returns

  • Polynomial: A polynomial modulo n.
source
Base.gensymMethod
gensym(q::Int) -> Vector{Symbol}

Generates a vector of unique symbols of length q.

source
Base.modMethod
mod(p::Polynomial, n::Int) -> Polynomial

Uses the FinitePolynomial constructor to return a polynomial p under modulus n.

Parameters:

  • p::Polynomial: The input polynomial.
  • n::Int: The modulus of the field.

Returns

  • Polynomial: A polynomial modulo n.
source
Base.randMethod
rand(𝒰::UniverseParameters, C::AbstractArray) -> Tuple

Given universe parameters 𝒰 and a code C, return a tuple including

  • A random word in C;
  • A random letter in the alphabet; and
  • A random index in the block length.
source
CodingTheory._has_identityMethod
_has_identity(M::Matrix, n::Union{T, Base.OneTo{T}, AbstractRange{T}}) where {T <: Integer}

Inner function on has_identity function. Will return a tuple of:

  • Whether or not the matrix has an identity;
  • Where that identity matrix starts; and
  • How big the identity matrix is.
source
CodingTheory.allequalMethod
allequal(A) -> Bool
+allequal(a, b...) -> Bool

Check that all elements in a list are equal to each other.

source
CodingTheory.aredistinctMethod
aredistinct(A) -> Bool
+aredistinct(a, b...) -> Bool

Check that all elements in a list are distinct from every other element in the list.

source
CodingTheory.areequaltoMethod
areequalto(x::Number, A::AbstractArray) -> Bool
+areequalto(x::Number, a, b...) -> Bool

Check that all elements in a list are equal to a given x.

source
CodingTheory.arelessthanMethod
arelessthan(x::Number, A) -> Bool
+arelessthan(x::Number, a, b...) -> Bool

Check that all elements in a list are less than a given x.

source
CodingTheory.code_distance!Method
code_distance!(C::AbstractArray{T}, w::T) -> Int

A wrapper to get the code distance after pushing a word to the code. This directly changes the matrix M. Use code_distance for a non-mutating version of this function.

Parameters:

  • C::AbstractArray: An array of words in the code.
  • w: A word to be appended to C.

Returns:

  • Int: The code distance after adding w to C.
source
CodingTheory.code_distanceMethod
code_distance(C::AbstractArray) -> Int

Finds the distance of the code. That is, given a code C, finds the minimum distance between any two words in the code, which are not the same. (Find the minimum hamming distance in the code for all unique letters).

Parameters:

  • C::AbstractArray: An array of words in the code.

Return:

  • Int: the distance of the code.
source
CodingTheory.code_distanceMethod
code_distance(C::AbstractArray{T}, w::T) -> Int

A wrapper to get the code distance after pushing a word to the code.

Parameters:

  • C::AbstractArray: An array of words in the code.
  • w: A word to be appended to C.

Returns:

  • Int: The code distance after adding w to C.

Examples

julia> code_distance([[0, 0, 0, 0, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 1, 1, 1, 1]]) # gets the minimum distance between two vectors in an array of vectors
+2
source
CodingTheory.construct_ham_matrixMethod
construct_ham_matrix(r::Int, q::Int) -> Matrix

Construct a Hamming parity-check matrix.

Parameters:

  • r::Int: number of rows of a parity check matrix.
  • q:::Int: The size of the alphabet of the code.

Returns:

  • Matrix: The Hamming matrix, denoted as $\text{Ham}(r, q)$

Examples

julia> construct_ham_matrix(3,2)
 3×7 Array{Int64,2}:
  0  0  0  1  1  1  1
  0  1  1  0  0  1  1
- 1  0  1  0  1  0  1
source
CodingTheory.deepeltypeMethod
deepeltype(a::AbstractArray) -> Type

Returns the type of the inner-most element in a nested array structure.

source
CodingTheory.ensure_symbolic!Method
ensure_symbolic!(Σ) -> typeof(Σ)

Ensures that the inner-most elements of a nested array structure are of the type Symbol. This is a mutating function. Use its twin, non-mutating function, ensure_symbolic, if you need a non-mutating version of this.

source
CodingTheory.equivalent_code!Method
equivalent_code!(M::AbstractArray{Int}, n::Int) -> Matrix{Int}

Peforms Gauss-Jordan elimination on a matrix M, but allows for column swapping. This constructs an "equivalent" matrix. This directly changes the matrix M. Use equivalent_code for a non-mutating version of this function.

Parameters:

  • M::AbstractArray{Int}: A matrix of Ints.
  • n::Int: The modulus of the finite field.

Returns:

  • Matrix{Int}: A which represents an "equivalent" code to that of the matrix M.

Examples

julia> equivalent_code!([1 2 0 1 2 1 2; 2 2 2 0 1 1 1; 1 0 1 1 2 1 2; 0 1 0 1 1 2 2], 3) # computes rref colswap = true
+ 1  0  1  0  1  0  1
source
CodingTheory.deepeltypeMethod
deepeltype(a::AbstractArray) -> Type

Returns the type of the inner-most element in a nested array structure.

source
CodingTheory.ensure_symbolic!Method
ensure_symbolic!(Σ) -> typeof(Σ)

Ensures that the inner-most elements of a nested array structure are of the type Symbol. This is a mutating function. Use its twin, non-mutating function, ensure_symbolic, if you need a non-mutating version of this.

source
CodingTheory.equivalent_code!Method
equivalent_code!(M::AbstractArray{Int}, n::Int) -> Matrix{Int}

Peforms Gauss-Jordan elimination on a matrix M, but allows for column swapping. This constructs an "equivalent" matrix. This directly changes the matrix M. Use equivalent_code for a non-mutating version of this function.

Parameters:

  • M::AbstractArray{Int}: A matrix of Ints.
  • n::Int: The modulus of the finite field.

Returns:

  • Matrix{Int}: A which represents an "equivalent" code to that of the matrix M.

Examples

julia> equivalent_code!([1 2 0 1 2 1 2; 2 2 2 0 1 1 1; 1 0 1 1 2 1 2; 0 1 0 1 1 2 2], 3) # computes rref colswap = true
 4×7 Array{Int64,2}:
 1  0  0  0  2  2  2
 0  1  0  0  2  0  1
 0  0  1  0  1  0  2
-0  0  0  1  2  2  1
source
CodingTheory.equivalent_codeMethod
equivalent_code(M::AbstractArray{Int}, n::Int) -> Matrix{Int}

Peforms Gauss-Jordan elimination on a matrix M, but allows for column swapping.

Parameters:

  • M::AbstractArray{Int}: A matrix of Ints.
  • n::Int: The modulus of the finite field.

Returns:

  • Matrix{Int}: A which represents an "equivalent" code to that of the matrix M.

Examples

julia> equivalent_code([1 2 0 1 2 1 2; 2 2 2 0 1 1 1; 1 0 1 1 2 1 2; 0 1 0 1 1 2 2], 3) # computes rref colswap = true
+0  0  0  1  2  2  1
source
CodingTheory.equivalent_codeMethod
equivalent_code(M::AbstractArray{Int}, n::Int) -> Matrix{Int}

Peforms Gauss-Jordan elimination on a matrix M, but allows for column swapping.

Parameters:

  • M::AbstractArray{Int}: A matrix of Ints.
  • n::Int: The modulus of the finite field.

Returns:

  • Matrix{Int}: A which represents an "equivalent" code to that of the matrix M.

Examples

julia> equivalent_code([1 2 0 1 2 1 2; 2 2 2 0 1 1 1; 1 0 1 1 2 1 2; 0 1 0 1 1 2 2], 3) # computes rref colswap = true
 4×7 Array{Int64,2}:
 1  0  0  0  2  2  2
 0  1  0  0  2  0  1
 0  0  1  0  1  0  2
-0  0  0  1  2  2  1
source
CodingTheory.find_error_correction_maxMethod
find_error_correction_max(C::AbstractArray{T}, modulo::Int) -> Int

Finds the greatest number t such that C is error t error correcting.

Parameters:

  • C::AbstractArray: An array of words in the code.
  • moldulo::Int: The modulus of the finite field. The upper bound of t.

Returns:

  • Int: The maximum number t such that the code is t error correcting.
source
CodingTheory.find_error_detection_maxMethod
find_error_detection_max(C::AbstractArray{T}, modulo::Int) -> Int

Finds the greatest number t such that C is error t error detecting.

Parameters:

  • C::AbstractArray: An array of words in the code.
  • moldulo::Int: The modulus of the finite field. The upper bound of t.

Returns:

  • Int: The maximum number t such that the code is t error detecting.

julia> find_error_detection_max([[0, 0, 0, 0], [0, 1, 1, 1], [1, 0, 1, 0], [1, 1, 0, 1]], 2)
-1
source
CodingTheory.generator!Method
generator!(M::AbstractArray{Int}, n::Int; colswap::Bool = true) -> Matrix{Int}

Constructs a generator matrix of the code, depending on if you allow for column swapping or not. This function uses normal_form! or equivalent_code!. This directly changes the matrix M. Use generator for a non-mutating version of this function.

Parameters:

  • M::AbstractArray{Int}: A matrix of Ints.
  • n::Int: The modulus of the finite field.
  • colswap::Bool (kwarg): A boolean flag indicating whether or not you allow for swapping of columns when constructing the generating matrix.

Returns:

  • Matrix{Int}: A generating matrix.
source
CodingTheory.generatorMethod
generator(M::AbstractArray{Int}, n::Int; colswap::Bool = true) -> Matrix{Int}

Constructs a generator matrix of the code, depending on if you allow for column swapping or not. This function uses normal_form or equivalent_code.

Parameters:

  • M::AbstractArray{Int}: A matrix of Ints.
  • n::Int: The modulus of the finite field.
  • colswap::Bool (kwarg): A boolean flag indicating whether or not you allow for swapping of columns when constructing the generating matrix.

Returns:

  • Matrix{Int}: A generating matrix.
source
CodingTheory.find_error_correction_maxMethod
find_error_correction_max(C::AbstractArray{T}, modulo::Int) -> Int

Finds the greatest number t such that C is error t error correcting.

Parameters:

  • C::AbstractArray: An array of words in the code.
  • moldulo::Int: The modulus of the finite field. The upper bound of t.

Returns:

  • Int: The maximum number t such that the code is t error correcting.
source
CodingTheory.find_error_detection_maxMethod
find_error_detection_max(C::AbstractArray{T}, modulo::Int) -> Int

Finds the greatest number t such that C is error t error detecting.

Parameters:

  • C::AbstractArray: An array of words in the code.
  • moldulo::Int: The modulus of the finite field. The upper bound of t.

Returns:

  • Int: The maximum number t such that the code is t error detecting.

julia> find_error_detection_max([[0, 0, 0, 0], [0, 1, 1, 1], [1, 0, 1, 0], [1, 1, 0, 1]], 2)
+1
source
CodingTheory.generator!Method
generator!(M::AbstractArray{Int}, n::Int; colswap::Bool = true) -> Matrix{Int}

Constructs a generator matrix of the code, depending on if you allow for column swapping or not. This function uses normal_form! or equivalent_code!. This directly changes the matrix M. Use generator for a non-mutating version of this function.

Parameters:

  • M::AbstractArray{Int}: A matrix of Ints.
  • n::Int: The modulus of the finite field.
  • colswap::Bool (kwarg): A boolean flag indicating whether or not you allow for swapping of columns when constructing the generating matrix.

Returns:

  • Matrix{Int}: A generating matrix.
source
CodingTheory.generatorMethod
generator(M::AbstractArray{Int}, n::Int; colswap::Bool = true) -> Matrix{Int}

Constructs a generator matrix of the code, depending on if you allow for column swapping or not. This function uses normal_form or equivalent_code.

Parameters:

  • M::AbstractArray{Int}: A matrix of Ints.
  • n::Int: The modulus of the finite field.
  • colswap::Bool (kwarg): A boolean flag indicating whether or not you allow for swapping of columns when constructing the generating matrix.

Returns:

  • Matrix{Int}: A generating matrix.
source
CodingTheory.get_all_wordsMethod
get_all_words(Σ::Alphabet{N}, q::Int, n::Int) -> Codewords{M}
 get_all_words(Σ::Alphabet{N}, n::Int) -> Codewords{M}
 get_all_words(Σ::AbstractArray, q::Int, n::Int) -> Codewords{M}
 get_all_words(Σ::AbstractArray, n::Int) -> Codewords{M}
 get_all_words(q::Int, n::Int) -> Codewords{M}

Get the universe of all codewords of a given alphabet. The alphabet will be uniquely generated if none is given.

Parameters:

  • Σ::AbstractArray: The alphabet allowed.
  • q::Int: The size of the alphabet.
  • n::Int: The (fixed) length of the words in the code.
  • d::Int: The minimum distance between words in the code.
  • 𝒰::AbstractArray: The universe of all codewords of q many letters of block length n.

Returns:

  • Codewords{M}: An array of codewords, each of length M. Each codewords is a tuple, and each character in said word is a symbol.

Examples

julia> get_all_words(2, 2) # all words of block length 2 using 2 unique symbols
 2×2 Array{Tuple{Symbol,Symbol},2}:
  (Symbol("##254"), Symbol("##254"))  (Symbol("##254"), Symbol("##253"))
- (Symbol("##253"), Symbol("##254"))  (Symbol("##253"), Symbol("##253"))
source
CodingTheory.get_codewordsMethod
get_codewords(G::AbstractArray, m::Int) -> Codewords{M}

Get codewords of a code from the generating matrix under a finite field of modulo m. Precisely, computes all linear combinations of the rows of the generating matrix.

Parameters:

  • G::AbstractArray: A matrix of Ints which generates the code.
  • m::Int: The bounds of the finite field (i.e., the molulus you wish to work in).

Returns:

  • Codewords{M}: An array of codewords, each of length M. Each codewords is a tuple, and each character in said word is a symbol.
source
CodingTheory.get_codewordsMethod
get_codewords(𝒰::UniverseParameters, d::Int; m::Int = 10, m_random::Int = 1000) ->
+ (Symbol("##253"), Symbol("##254"))  (Symbol("##253"), Symbol("##253"))
source
CodingTheory.get_codewordsMethod
get_codewords(G::AbstractArray, m::Int) -> Codewords{M}

Get codewords of a code from the generating matrix under a finite field of modulo m. Precisely, computes all linear combinations of the rows of the generating matrix.

Parameters:

  • G::AbstractArray: A matrix of Ints which generates the code.
  • m::Int: The bounds of the finite field (i.e., the molulus you wish to work in).

Returns:

  • Codewords{M}: An array of codewords, each of length M. Each codewords is a tuple, and each character in said word is a symbol.
source
CodingTheory.get_codewordsMethod
get_codewords(𝒰::UniverseParameters, d::Int; m::Int = 10, m_random::Int = 1000) ->
     Codewords{M}
 get_codewords(Σ::Alphabet{N}, q::Int, n::Int, d::Int; m::Int = 10, m_random::Int = 1000) ->
     Codewords{M}
@@ -105,14 +73,14 @@
  (:a, :a, :c)
  (:a, :c, :b)
  (:c, :c, :a)
- (:b, :b, :b)
source
CodingTheory.get_codewords_greedyMethod
get_codewords_greedy(𝒰::UniverseParameters, d::Int) -> Codewords{M}
 get_codewords_greedy(Σ::Alphabet{N}, q::Int, n::Int, d::Int) -> Codewords{M}
 get_codewords_greedy(Σ::Alphabet{N}, n::Int, d::Int) -> Codewords{M}
 get_codewords_greedy(q::Int, n::Int, d::Int) -> Codewords{M}
 get_codewords_greedy(Σ::AbstractArray, q::Int, n::Int, d::Int) -> Codewords{M}
 get_codewords_greedy(Σ::AbstractArray, n::Int, d::Int) -> Codewords{M}
 get_codewords_greedy(Σ::AbstractArray, q::Int, n::Int, d::Int, 𝒰::AbstractArray) ->
-    Codewords{M}

Search through the universe of all codewords and find a code of block length n and distance d, using the alphabet Σ. The alphabet will be uniquely generated if none is given. This uses a greedy algorithm, simply iterating through all words (see above) and choosing them if they fit in the code. In some cases the greedy algorithm is the best, but in others it is very much not.

Parameters:

  • 𝒰::UniverseParameters: The parameters of the universe of all codewords of q many letters of block length n.
  • Σ::AbstractArray: The alphabet allowed.
  • q::Int: The size of the alphabet.
  • n::Int: The (fixed) length of the words in the code.
  • d::Int: The minimum distance between words in the code.

Returns:

  • Codewords{M}: An array of codewords, each of length M. Each codewords is a tuple, and each character in said word is a symbol.
source
CodingTheory.get_codewords_randomMethod
get_codewords_random(𝒰::UniverseParameters, d::Int; m::Int = 1000) -> Codewords{M}
+    Codewords{M}

Search through the universe of all codewords and find a code of block length n and distance d, using the alphabet Σ. The alphabet will be uniquely generated if none is given. This uses a greedy algorithm, simply iterating through all words (see above) and choosing them if they fit in the code. In some cases the greedy algorithm is the best, but in others it is very much not.

Parameters:

  • 𝒰::UniverseParameters: The parameters of the universe of all codewords of q many letters of block length n.
  • Σ::AbstractArray: The alphabet allowed.
  • q::Int: The size of the alphabet.
  • n::Int: The (fixed) length of the words in the code.
  • d::Int: The minimum distance between words in the code.

Returns:

  • Codewords{M}: An array of codewords, each of length M. Each codewords is a tuple, and each character in said word is a symbol.
source
CodingTheory.get_codewords_randomMethod
get_codewords_random(𝒰::UniverseParameters, d::Int; m::Int = 1000) -> Codewords{M}
 get_codewords_random(Σ::Alphabet{N}, q::Int, n::Int, d::Int; m::Int = 1000) -> Codewords{M}
 get_codewords_random(Σ::Alphabet{N}, n::Int, d::Int; m::Int = 1000) -> Codewords{M}
 get_codewords_random(q::Int, n::Int, d::Int; m::Int = 1000) -> Codewords{M}
@@ -121,11 +89,11 @@
 get_codewords_random(Σ::AbstractArray, n::Int, d::Int; m::Int = 1000) -> Codewords{M}
 get_codewords_random(
     Σ::AbstractArray, q::Int, n::Int, d::Int, 𝒰::AbstractArray; m::Int = 1000
-) -> Codewords{M}

Search through the universe of all codewords at random and find a code of block length n and distance d, using the alphabet Σ. The alphabet will be uniquely generated if none is given. This is a cleverer algorithm than the greedy algorithm. Increasing the m keyword argument arbitrarily should produce a maximal code, as for each codeword it chooses, it collects a list of m many random words, and chooses the best one from that intermediate list.

Parameters:

  • Σ::AbstractArray: The alphabet allowed.
  • q::Int: The size of the alphabet.
  • n::Int: The (fixed) length of the words in the code.
  • d::Int: The minimum distance between words in the code.
  • 𝒰::AbstractArray: The universe of all codewords of q many letters of block length n.

Returns:

  • Codewords{M}: An array of codewords, each of length M. Each codewords is a tuple, and each character in said word is a symbol. # get a random word in the code start
source
CodingTheory.hamming_ballMethod
hamming_ball(Σⁿ::AbstractArray, w::Vector, e::Int) -> Vector{Vector}

Get the codewords of radius $e$ of a ball centered at word $w$. That is, all words whose distance from w is less than or equal to the radius.

Parameters:

  • Σⁿ::AbstractArray: An array of words in the code.
  • w::Vector: A word.
  • e::Int: The radius of the ball.

Returns:

  • AbstractArray: The list of words in Σⁿ whose distance from w is less than or equal to e. Returns an array of array of symbols.

Examples

julia> hamming_ball([[1, 0, 1], [0, 1, 1], [1, 0, 0]], [1, 0, 0], 2) # given a list of words, a word, and a distance e (respectively), calculate all the words in the alphabet within distance e of that word.  Converts to symbols in order to keep unique lengths
+) -> Codewords{M}

Search through the universe of all codewords at random and find a code of block length n and distance d, using the alphabet Σ. The alphabet will be uniquely generated if none is given. This is a cleverer algorithm than the greedy algorithm. Increasing the m keyword argument arbitrarily should produce a maximal code, as for each codeword it chooses, it collects a list of m many random words, and chooses the best one from that intermediate list.

Parameters:

  • Σ::AbstractArray: The alphabet allowed.
  • q::Int: The size of the alphabet.
  • n::Int: The (fixed) length of the words in the code.
  • d::Int: The minimum distance between words in the code.
  • 𝒰::AbstractArray: The universe of all codewords of q many letters of block length n.

Returns:

  • Codewords{M}: An array of codewords, each of length M. Each codewords is a tuple, and each character in said word is a symbol. # get a random word in the code start
source
CodingTheory.hamming_ballMethod
hamming_ball(Σⁿ::AbstractArray, w::Vector, e::Int) -> Vector{Vector}

Get the codewords of radius $e$ of a ball centered at word $w$. That is, all words whose distance from w is less than or equal to the radius.

Parameters:

  • Σⁿ::AbstractArray: An array of words in the code.
  • w::Vector: A word.
  • e::Int: The radius of the ball.

Returns:

  • AbstractArray: The list of words in Σⁿ whose distance from w is less than or equal to e. Returns an array of array of symbols.

Examples

julia> hamming_ball([[1, 0, 1], [0, 1, 1], [1, 0, 0]], [1, 0, 0], 2) # given a list of words, a word, and a distance e (respectively), calculate all the words in the alphabet within distance e of that word.  Converts to symbols in order to keep unique lengths
 2-element Array{Any,1}:
  [Symbol("1"), Symbol("0"), Symbol("1")]
- [Symbol("1"), Symbol("0"), Symbol("0")]
source
CodingTheory.hamming_distanceMethod
hamming_distance(w₁, w₂) -> Int

The Hamming distance of two words is the number of changes that need to be made to each letter in the word for the words to be the same. This does not work for words of unequal length.

Parameters:

  • w₁: A word.
  • w₂: Another word.

Returns:

  • Int: the number of changes needing to be made to one word for it to be identical to the other.

Examples

julia> hamming_distance("ABC", "BBC") # computes the hamming distance
-1
source
CodingTheory.hamming_sphereMethod
hamming_sphere(Σⁿ::AbstractArray, w::Vector, e::Int) -> Vector{Vector}

Get the codewords of radius e of a sohere centered at word w. That is, all words whose distance from w is exactly equal to to the radius.

Parameters:

  • Σⁿ::AbstractArray: An array of words in the code.
  • w::Vector: A word.
  • e::Int: The radius of the ball.

Returns:

  • AbstractArray: The list of words in Σⁿ whose distance from w is exactly equal to e. Returns an array of array of symbols.
source
CodingTheory.hamming_distanceMethod
hamming_distance(w₁, w₂) -> Int

The Hamming distance of two words is the number of changes that need to be made to each letter in the word for the words to be the same. This does not work for words of unequal length.

Parameters:

  • w₁: A word.
  • w₂: Another word.

Returns:

  • Int: the number of changes needing to be made to one word for it to be identical to the other.

Examples

julia> hamming_distance("ABC", "BBC") # computes the hamming distance
+1
source
CodingTheory.hamming_sphereMethod
hamming_sphere(Σⁿ::AbstractArray, w::Vector, e::Int) -> Vector{Vector}

Get the codewords of radius e of a sohere centered at word w. That is, all words whose distance from w is exactly equal to to the radius.

Parameters:

  • Σⁿ::AbstractArray: An array of words in the code.
  • w::Vector: A word.
  • e::Int: The radius of the ball.

Returns:

  • AbstractArray: The list of words in Σⁿ whose distance from w is exactly equal to e. Returns an array of array of symbols.
source
CodingTheory.has_identityMethod
has_identity(M::Matrix) -> Bool
 has_identity(M::Matrix, n::Integer) -> Bool

Checks if a matrix has an identity in it. If given a number n, the function will specifically check if it has an identity matrix of size n in M.

See CodingTheory._has_identity for more information.

Examples

julia> A = [1 0 0 2 3 0; 0 1 0 1 2 2; 0 0 1 4 3 0]
 3×6 Array{Int64,2}:
  1  0  0  2  3  0
@@ -176,7 +144,7 @@
 true
 
 julia> has_identity(D, 4)
-false
source
CodingTheory.has_identity_on_leftMethod
has_identity_on_left(M::Matrix) -> Bool

Checks if the left-hand side of a matrix contains an identity matrix.

Examples

julia> A = [1 0 0 2 3 0; 0 1 0 1 2 2; 0 0 1 4 3 0]
+false
source
CodingTheory.has_identity_on_leftMethod
has_identity_on_left(M::Matrix) -> Bool

Checks if the left-hand side of a matrix contains an identity matrix.

Examples

julia> A = [1 0 0 2 3 0; 0 1 0 1 2 2; 0 0 1 4 3 0]
 3×6 Array{Int64,2}:
  1  0  0  2  3  0
  0  1  0  1  2  2
@@ -192,15 +160,15 @@
 true
 
 julia> has_identity_on_left(B)
-false
source
CodingTheory.isgolayperfectMethod
isgolayperfect(n::Int, k::Int, d::Int, q::Int) -> Bool

Golay found two perfect codes. isgolayperfect checks if a code of block length n, distance d, alphabet size q, and dimension k, is a perfect code as described by Golay.

Parameters:

  • n::Int: The block length of words in the code (e.g., word "abc" has block length 3).
  • k::Int: The dimension of the code.
  • d::Int: The distance of the code (i.e., the minimum distance between codewords in the code).
  • q::Int: An Int that is a prime power. The modulus of the finite field.

Returns:

  • Bool: true or false.

Examples

julia> isgolayperfect(11, 6, 5, 3) # this is one of golay's perfect codes
-true
source
CodingTheory.ishammingperfectMethod
ishammingbound(r::Int, q::Int) -> Bool

Checks if the code is a perfect code that is of the form of a generalised Hamming code.

Parameters:

  • r::Int: number of rows of a parity check matrix.
  • q::Int: The size of the alphabet of the code.

Returns:

  • Bool: true or false
source
CodingTheory.isgolayperfectMethod
isgolayperfect(n::Int, k::Int, d::Int, q::Int) -> Bool

Golay found two perfect codes. isgolayperfect checks if a code of block length n, distance d, alphabet size q, and dimension k, is a perfect code as described by Golay.

Parameters:

  • n::Int: The block length of words in the code (e.g., word "abc" has block length 3).
  • k::Int: The dimension of the code.
  • d::Int: The distance of the code (i.e., the minimum distance between codewords in the code).
  • q::Int: An Int that is a prime power. The modulus of the finite field.

Returns:

  • Bool: true or false.

Examples

julia> isgolayperfect(11, 6, 5, 3) # this is one of golay's perfect codes
+true
source
CodingTheory.ishammingperfectMethod
ishammingbound(r::Int, q::Int) -> Bool

Checks if the code is a perfect code that is of the form of a generalised Hamming code.

Parameters:

  • r::Int: number of rows of a parity check matrix.
  • q::Int: The size of the alphabet of the code.

Returns:

  • Bool: true or false
source
CodingTheory.ishammingperfectMethod
ishammingperfect(n::Int, k::Int, d::Int, q::Int) -> Bool
 ishammingperfect(q::Int, n::Int, d::Int) -> Bool

Checks if the code is a perfect code that is of the form of a generalised Hamming code.

Parameters:

  • q:::Int: The size of the alphabet of the code.
  • n::Int: The length of the words in the code (block length).
  • d::Int: The distance of the code.
  • k::Int: The dimension of the code.

Returns:

  • Bool: true or false

Examples

julia> isgolayperfect(11, 6, 5, 3) # this is one of golay's perfect codes
-true
source
CodingTheory.isincodeMethod
isincode(v̲::Vector, Hᵀ::AbstractArray{Int}, n::Int) -> Bool

If the syndrome of a code is the zero vector, then the word used to calculate the syndrome is in the code.

Parameters:

  • v̲::Vector: A word.
  • Hᵀ::AbstractArray{Int}: The transpose of a parity check matrix.

Returns:

  • Bool: If the word is in the code or not (true or false).

Examples

julia> isincode([0, 2, 1, 2, 0, 1, 0], transpose(parity_check([1 0 0 0 2 2 2; 0 1 0 0 2 0 1; 0 0 1 0 1 0 2; 0 0 0 1 2 2 1], 3)), 3) # tests if the syndrome is equal to the zero vector, and is thus in the code
-true
source
CodingTheory.isirreducibleMethod
isirreducible(f::AbstractPolynomial, modulo::Int) -> Bool

Checks if a polynomial is irreducible.

Parameters:

  • f::Polynomial: The polynomial you need to check.
  • modulo::Int: The modulus under which you are working.

Returns:

  • Bool: Whether or not the polynomial is irreducible (true or false).

Examples

julia> isirreducible(Polynomial([1, 1, 0, 0, 1]), 2) # is 1 + x + x^4 mod 2 irreducible?
-true
source
CodingTheory.islinearMethod
islinear(C::Vector, modulo::Int; verbose::Bool = false) -> Bool

Determines whether a code C is a linear code (i.e., if it is closed under addition, scalar multiplication, and has the zero vector in it).

Parameters:

  • C::Vector: A code, typically consisting of multiple vectors or strings.
  • modulo::Int: The modulus of the field under which you are working.
  • verbose::Bool (kwarg): print the point at which C fails, if it does.

Returns:

  • Bool: Whether or not the code C is linear (true or false).

Examples


+true
source
CodingTheory.isincodeMethod
isincode(v̲::Vector, Hᵀ::AbstractArray{Int}, n::Int) -> Bool

If the syndrome of a code is the zero vector, then the word used to calculate the syndrome is in the code.

Parameters:

  • v̲::Vector: A word.
  • Hᵀ::AbstractArray{Int}: The transpose of a parity check matrix.

Returns:

  • Bool: If the word is in the code or not (true or false).

Examples

julia> isincode([0, 2, 1, 2, 0, 1, 0], transpose(parity_check([1 0 0 0 2 2 2; 0 1 0 0 2 0 1; 0 0 1 0 1 0 2; 0 0 0 1 2 2 1], 3)), 3) # tests if the syndrome is equal to the zero vector, and is thus in the code
+true
source
CodingTheory.isirreducibleMethod
isirreducible(f::AbstractPolynomial, modulo::Int) -> Bool

Checks if a polynomial is irreducible.

Parameters:

  • f::Polynomial: The polynomial you need to check.
  • modulo::Int: The modulus under which you are working.

Returns:

  • Bool: Whether or not the polynomial is irreducible (true or false).

Examples

julia> isirreducible(Polynomial([1, 1, 0, 0, 1]), 2) # is 1 + x + x^4 mod 2 irreducible?
+true
source
CodingTheory.islinearMethod
islinear(C::Vector, modulo::Int; verbose::Bool = false) -> Bool

Determines whether a code C is a linear code (i.e., if it is closed under addition, scalar multiplication, and has the zero vector in it).

Parameters:

  • C::Vector: A code, typically consisting of multiple vectors or strings.
  • modulo::Int: The modulus of the field under which you are working.
  • verbose::Bool (kwarg): print the point at which C fails, if it does.

Returns:

  • Bool: Whether or not the code C is linear (true or false).

Examples


 julia> islinear([[0,0,0],[1,1,1],[1,0,1],[1,1,0]], 2) # checks whether a vector of vectors is linear/a subspace (modulo 2)
-false
source
CodingTheory.isperfectMethod
isperfect(n::Int, k::Int, d::Int, q::Int) -> Bool

Checks if a code is perfect. That is, checks if the number of words in the code is exactly the "Hamming bound", or the "Sphere Packing Bound".

Parameters:

  • q:::Int: The size of the alphabet of the code.
  • n::Int: The length of the words in the code (block length).
  • d::Int: The distance of the code.
  • k::Int: The dimension of the code.

Returns:

  • Bool: true or false

Examples

julia> isperfect(11, 6, 5, 3)
-true
source
CodingTheory.isperfectpowerMethod
isperfectpower(n::Integer) -> Bool

Given an integer n, returns true or false depending on whether or not it is a perfect power.

Here, a perfect power is some number of the form $a^b$, where $a, b \in \mathbb{N}$, and $b > 1$.

This function is a wrapper around Hecke.jl's really excellent and efficient ispower function.

Note

It should be noted that there is another defintion for "perfect powers": > some number of the form $p^b$, where $p, b \in \mathbb{N}$, and $p$ is a prime number``. Here, we call numbers of this form prime powers, or proper perfect powers. By this definition, 36 is not a perfect power, because 6 is not prime.

See also: CodingTheory.isperfectpower.

source
CodingTheory.isperfectMethod
isperfect(n::Int, k::Int, d::Int, q::Int) -> Bool

Checks if a code is perfect. That is, checks if the number of words in the code is exactly the "Hamming bound", or the "Sphere Packing Bound".

Parameters:

  • q:::Int: The size of the alphabet of the code.
  • n::Int: The length of the words in the code (block length).
  • d::Int: The distance of the code.
  • k::Int: The dimension of the code.

Returns:

  • Bool: true or false

Examples

julia> isperfect(11, 6, 5, 3)
+true
source
CodingTheory.isperfectpowerMethod
isperfectpower(n::Integer) -> Bool

Given an integer n, returns true or false depending on whether or not it is a perfect power.

Here, a perfect power is some number of the form $a^b$, where $a, b \in \mathbb{N}$, and $b > 1$.

This function is a wrapper around Hecke.jl's really excellent and efficient ispower function.

Note

It should be noted that there is another defintion for "perfect powers": > some number of the form $p^b$, where $p, b \in \mathbb{N}$, and $p$ is a prime number``. Here, we call numbers of this form prime powers, or proper perfect powers. By this definition, 36 is not a perfect power, because 6 is not prime.

See also: CodingTheory.isperfectpower.

source
CodingTheory.levenshteinMethod
levenshtein(source::AbstractString, target::AbstractString) -> Integer
 levenshtein(source::AbstractString, target::AbstractString, cost::Real) -> Integer
 levenshtein(
     source::AbstractString,
@@ -216,7 +184,7 @@
     insertion_cost::S,
     substitution_cost::T;
     costs::Matrix = Array{promote_type(R, S, T)}(undef, 2, length(target) + 1),
-) -> Integer

Computes the Levenshtein distance.

These methods are adapted from Levenshtein.jl, by Roger Tu.

source
CodingTheory.list_polysMethod
list_polys(n::Int, m::Int) -> Array

Lists all polynomials of degree less than to n under modulo m.

Parameters:

  • n::Int: Highest degree of polynomial.
  • m::Int: The modulus of the field.

Returns:

  • Array: An array of polynomials of degree less than n, under modulo m.
source
CodingTheory.list_spanMethod
list_span(u̲::Vector, v̲::Vector,... modulo::Int) -> Array

Given any number of vectors , ,... , prints all linear combinations of those vectors, modulo modulo.

Parameters:

  • u̲::Vector: One vector.
  • v̲::Vector: Another vector.
  • ...: Other vectors.
  • modulo::Int: The modulus of the field.

Returns:

  • Array: All vectors in the span of u̲ and v̲, under modulo.

Examples

julia> list_span([2, 1, 1], [1, 1, 1], 3) # list the span of two vectors modulo 3
+) -> Integer

Computes the Levenshtein distance.

These methods are adapted from Levenshtein.jl, by Roger Tu.

source
CodingTheory.list_polysMethod
list_polys(n::Int, m::Int) -> Array

Lists all polynomials of degree less than to n under modulo m.

Parameters:

  • n::Int: Highest degree of polynomial.
  • m::Int: The modulus of the field.

Returns:

  • Array: An array of polynomials of degree less than n, under modulo m.
source
CodingTheory.list_spanMethod
list_span(u̲::Vector, v̲::Vector,... modulo::Int) -> Array

Given any number of vectors , ,... , prints all linear combinations of those vectors, modulo modulo.

Parameters:

  • u̲::Vector: One vector.
  • v̲::Vector: Another vector.
  • ...: Other vectors.
  • modulo::Int: The modulus of the field.

Returns:

  • Array: All vectors in the span of u̲ and v̲, under modulo.

Examples

julia> list_span([2, 1, 1], [1, 1, 1], 3) # list the span of two vectors modulo 3
 9-element Array{Array{T,1} where T,1}:
  [0, 0, 0]
  [1, 1, 1]
@@ -226,7 +194,7 @@
  [1, 0, 0]
  [1, 2, 2]
  [2, 0, 0]
- [0, 1, 1]
source
CodingTheory.multiplication_tableMethod
multiplication_table(degree::Int, modulo::Int) -> Matrix

Returns a table (matrix) of the multiplication of all combinations of polynomials for degree less than degree, under modulo modulo.

Parameters:

  • degree::Int: Highest degree of polynomial.
  • modulo::Int: The modulus of the field.

Returns:

  • Matrix: A multiplication table of all polynomials with degree less than n, under modulus.

Examples

julia> julia> multiplication_table(2, 3) # multiplication table of all polynomials of degree less than 3 modulo 2
+ [0, 1, 1]
source
CodingTheory.multiplication_tableMethod
multiplication_table(degree::Int, modulo::Int) -> Matrix

Returns a table (matrix) of the multiplication of all combinations of polynomials for degree less than degree, under modulo modulo.

Parameters:

  • degree::Int: Highest degree of polynomial.
  • modulo::Int: The modulus of the field.

Returns:

  • Matrix: A multiplication table of all polynomials with degree less than n, under modulus.

Examples

julia> julia> multiplication_table(2, 3) # multiplication table of all polynomials of degree less than 3 modulo 2
 9×9 Array{Polynomial,2}:
  Polynomial(0)  Polynomial(0)        Polynomial(0)        …  Polynomial(0)                Polynomial(0)
  Polynomial(0)  Polynomial(1)        Polynomial(2)           Polynomial(1 + 2*x)          Polynomial(2 + 2*x)
@@ -236,22 +204,22 @@
  Polynomial(0)  Polynomial(2 + x)    Polynomial(1 + 2*x)  …  Polynomial(2 + 2*x + 2*x^2)  Polynomial(1 + 2*x^2)
  Polynomial(0)  Polynomial(2*x)      Polynomial(x)           Polynomial(2*x + x^2)        Polynomial(x + x^2)
  Polynomial(0)  Polynomial(1 + 2*x)  Polynomial(2 + x)       Polynomial(1 + x + x^2)      Polynomial(2 + x^2)
- Polynomial(0)  Polynomial(2 + 2*x)  Polynomial(1 + x)       Polynomial(2 + x^2)          Polynomial(1 + 2*x + x^2)
source
CodingTheory.mutate_codewordMethod
mutate_codeword(w::NonStaticAbstractWord{N, T}, n::Int, i::Int, a::T) where {T, N} ->
+ Polynomial(0)  Polynomial(2 + 2*x)  Polynomial(1 + x)       Polynomial(2 + x^2)          Polynomial(1 + 2*x + x^2)
source
CodingTheory.mutate_codewordMethod
mutate_codeword(w::NonStaticAbstractWord{N, T}, n::Int, i::Int, a::T) where {T, N} ->
     MVector{N, T}
-mutate_codeword(w::Word{N, T}, n::Int, i::Int, a::T) where {T, N} -> MVector{N, T}

Mutates the word w, which is an MVector of length N, changing its iᵗʰ index to a.

source
CodingTheory.normal_form!Method
normal_form!(M::AbstractArray{Int}, n::Int) -> Matrix{Int}

Convert a matrix M into normal form under modulo n via Gauss-Jordan elimination. This directly changes the matrix M. Use normal_form for a non-mutating version of this function.

Parameters:

  • M::AbstractArray{Int}: A matrix of Ints.
  • n::Int: The modulus of the finite field.

Returns:

  • Matrix{Int}: A matrix in normal form from Gauss-Jordan elimination.

Examples


+mutate_codeword(w::Word{N, T}, n::Int, i::Int, a::T) where {T, N} -> MVector{N, T}

Mutates the word w, which is an MVector of length N, changing its iᵗʰ index to a.

source
CodingTheory.normal_form!Method
normal_form!(M::AbstractArray{Int}, n::Int) -> Matrix{Int}

Convert a matrix M into normal form under modulo n via Gauss-Jordan elimination. This directly changes the matrix M. Use normal_form for a non-mutating version of this function.

Parameters:

  • M::AbstractArray{Int}: A matrix of Ints.
  • n::Int: The modulus of the finite field.

Returns:

  • Matrix{Int}: A matrix in normal form from Gauss-Jordan elimination.

Examples


 julia> normal_form!([1 2 0 1 2 1 2; 2 2 2 0 1 1 1; 1 0 1 1 2 1 2; 0 1 0 1 1 2 2], 3) # computes rref colswap = false
 4×7 Array{Int64,2}:
 1  0  0  0  2  2  2
 0  1  0  0  2  0  1
 0  0  1  0  1  0  2
-0  0  0  1  2  2  1
source
CodingTheory.normal_formMethod
normal_form(M::AbstractArray{Int}, n::Int) -> Matrix{Int}

Convert a matrix M into normal form under modulo n via Gauss-Jordan elimination.

Parameters:

  • M::AbstractArray{Int}: A matrix of Ints.
  • n::Int: The modulus of the finite field.

Returns:

  • Matrix{Int}: A matrix in normal form from Gauss-Jordan elimination.

Examples


+0  0  0  1  2  2  1
source
CodingTheory.normal_formMethod
normal_form(M::AbstractArray{Int}, n::Int) -> Matrix{Int}

Convert a matrix M into normal form under modulo n via Gauss-Jordan elimination.

Parameters:

  • M::AbstractArray{Int}: A matrix of Ints.
  • n::Int: The modulus of the finite field.

Returns:

  • Matrix{Int}: A matrix in normal form from Gauss-Jordan elimination.

Examples


 julia> normal_form([1 2 0 1 2 1 2; 2 2 2 0 1 1 1; 1 0 1 1 2 1 2; 0 1 0 1 1 2 2], 3) # computes rref colswap = false
 4×7 Array{Int64,2}:
 1  0  0  0  2  2  2
 0  1  0  0  2  0  1
 0  0  1  0  1  0  2
-0  0  0  1  2  2  1
source
CodingTheory.parity_checkMethod
parity_check(M::AbstractArray{Int}, n::Int) -> Matrix{Int}

Constructs a parity check matrix. This is calculated from taking the non-identity part of a matrix in normal form (or equivalent &mdash; see generator), transposing it, multiplying it by negative one, and appending to it an appropriate sized identity matrix.

Parameters:

  • M::AbstractArray{Int}: A matrix of Ints.
  • n::Int: The modulus of the finite field.

Returns:

  • Matrix{Int}: A parity check matrix.
source
CodingTheory.push_if_allowed!Method
push_if_allowed!(C::AbstractArray{T}, w::T, d::Int)

Takes in an array and a word. As long as the word does not mean that the distance is smaller than d, we add w to the array. If we are successful in doing this, return true. Otherwise, return false. This is a mutating function.

source
CodingTheory.push_if_allowed!Method
push_if_allowed!(C::AbstractArray{T}, C′::AbstractArray{T}, w::T, d::Int)

Takes in two arrays, A and B. If w is allowed in C given distance d, push to C′. If we are successful in doing this, return true. Otherwise, return false. This is a mutating function.

source
CodingTheory.rateMethod
rate(q::Integer, M::Integer, n::Integer) -> Real

Calculate the rate of a code. That is, how efficient the code is.

Parameters:

  • q::Integer: the number of symbols in the code.
  • M::Integer: the size/number of elements in the code.
  • n::Integer: The word length.

Returns:

  • Real: Rate of the code.

Examples

julia> rate(3, 5, 4) # the rate of the code which has 3 symbols, 5 words in the code, and word length of 4 (e.g., Σ = {A, B, C}, C = {ABBA,CABA,BBBB,CAAB,ACBB})
-0.3662433801794817
source
CodingTheory.replace_if_allowed!Method
replace_if_allowed!(C::AbstractArray, d::Int, w, w′) -> Bool

Takes in an array and a word. As long as the word does not mean that the distance is smaller than d, we replace a with b in the array. Replaces and returns true if allowed; otherwise returns false. This is a mutating function.

source
CodingTheory.parity_checkMethod
parity_check(M::AbstractArray{Int}, n::Int) -> Matrix{Int}

Constructs a parity check matrix. This is calculated from taking the non-identity part of a matrix in normal form (or equivalent &mdash; see generator), transposing it, multiplying it by negative one, and appending to it an appropriate sized identity matrix.

Parameters:

  • M::AbstractArray{Int}: A matrix of Ints.
  • n::Int: The modulus of the finite field.

Returns:

  • Matrix{Int}: A parity check matrix.
source
CodingTheory.push_if_allowed!Method
push_if_allowed!(C::AbstractArray{T}, w::T, d::Int)

Takes in an array and a word. As long as the word does not mean that the distance is smaller than d, we add w to the array. If we are successful in doing this, return true. Otherwise, return false. This is a mutating function.

source
CodingTheory.push_if_allowed!Method
push_if_allowed!(C::AbstractArray{T}, C′::AbstractArray{T}, w::T, d::Int)

Takes in two arrays, A and B. If w is allowed in C given distance d, push to C′. If we are successful in doing this, return true. Otherwise, return false. This is a mutating function.

source
CodingTheory.rateMethod
rate(q::Integer, M::Integer, n::Integer) -> Real

Calculate the rate of a code. That is, how efficient the code is.

Parameters:

  • q::Integer: the number of symbols in the code.
  • M::Integer: the size/number of elements in the code.
  • n::Integer: The word length.

Returns:

  • Real: Rate of the code.

Examples

julia> rate(3, 5, 4) # the rate of the code which has 3 symbols, 5 words in the code, and word length of 4 (e.g., Σ = {A, B, C}, C = {ABBA,CABA,BBBB,CAAB,ACBB})
+0.3662433801794817
source
CodingTheory.replace_if_allowed!Method
replace_if_allowed!(C::AbstractArray, d::Int, w, w′) -> Bool

Takes in an array and a word. As long as the word does not mean that the distance is smaller than d, we replace a with b in the array. Replaces and returns true if allowed; otherwise returns false. This is a mutating function.

source
CodingTheory.rref!Method
rref!(
     A::Matrix{Int},
     n::Int;
     colswap::Bool = false,
@@ -261,7 +229,7 @@
 3×6 Array{Int64,2}:
  1  0  0  3  2  2
  0  1  0  2  1  1
- 0  0  1  0  0  4
    # Rule 1: Swap zero rows if out of order and ensure leading ones cascade down diagonally.

```

source
CodingTheory.rrefMethod
rref(
+ 0  0  1  0  0  4
    # Rule 1: Swap zero rows if out of order and ensure leading ones cascade down diagonally.

```

source
CodingTheory.rrefMethod
rref(
     A::Matrix{Int},
     n::Int;
     colswap::Bool = false,
@@ -271,14 +239,14 @@
 3×6 Array{Int64,2}:
  1  0  0  3  2  2
  0  1  0  2  1  1
- 0  0  1  0  0  4
source
CodingTheory.sizeof_all_wordsMethod
sizeof_all_words(q::Number, n::Number) -> Number

Calculates the number of gigabytes required to store all unique words of length n from an alphabet of size q.

source
CodingTheory.sizeof_perfect_codeMethod
sizeof_perfect_code(q::Number, n::Number, d::Number) -> Number

Calculates the number of gigabytes required to store a perfect code of parameters q, n, and d.

source
CodingTheory.sphere_covering_boundMethod
sphere_covering_bound(q::Integer, n::Integer, d::Integer) -> Integer

Computes the sphere covering bound of a $[n, d]_q$-code.

Parameters:

  • q::Integer: the number of symbols in the code.
  • n::Integer: the word length.
  • d::Integer: the distance of the code.

Returns:

  • Integer: the sphere covering bound.

Examples

julia> sphere_covering_bound(5, 7, 3)
-215
source
CodingTheory.sizeof_all_wordsMethod
sizeof_all_words(q::Number, n::Number) -> Number

Calculates the number of gigabytes required to store all unique words of length n from an alphabet of size q.

source
CodingTheory.sizeof_perfect_codeMethod
sizeof_perfect_code(q::Number, n::Number, d::Number) -> Number

Calculates the number of gigabytes required to store a perfect code of parameters q, n, and d.

source
CodingTheory.sphere_covering_boundMethod
sphere_covering_bound(q::Integer, n::Integer, d::Integer) -> Integer

Computes the sphere covering bound of a $[n, d]_q$-code.

Parameters:

  • q::Integer: the number of symbols in the code.
  • n::Integer: the word length.
  • d::Integer: the distance of the code.

Returns:

  • Integer: the sphere covering bound.

Examples

julia> sphere_covering_bound(5, 7, 3)
+215
source
CodingTheory.sphere_packing_boundMethod
sphere_packing_bound(q::Integer, n::Integer, d::Integer) -> Integer
 sphere_packing_bound(q::Integer, n::Integer, d::Integer, ::Rounding) -> Real

Computes the sphere packing bound of a $[n, d]_q$-code. The sphere packing bound is also known as the hamming bound. You can use hamming_bound to compute the same thing.

Parameters:

  • q::Integer: the number of symbols in the code.
  • n::Integer: the word length.
  • d::Integer: the distance of the code.
  • ::Rounding: use the argument no_round in this position to preserve the rounding of the code — which usually by default rounds down.

Returns:

  • Integer: the sphere packing bound.

Examples

julia> sphere_packing_bound(5, 7, 3)
-2693
source
CodingTheory.syndromeMethod
syndrome(v̲::Vector, Hᵀ::AbstractArray{Int}, n::Int) -> Matrix{Int}

Calculates the syndrome of a given word v̲ and a parity check matrix, transposed (Hᵀ), under modulo n.

Parameters:

  • v̲::Vector: A word in the code.
  • Hᵀ::AbstractArray{Int}: The transpose of a parity check matrix.

Returns:

  • Vector: The syndrome of a word in the code.

Examples

julia> syndrome([0, 2, 1, 2, 0, 1, 0], [1 1 1; 1 0 2; 2 0 1; 1 1 2; 1 0 0; 0 1 0; 0 0 1], 3)
+2693
source
CodingTheory.syndromeMethod
syndrome(v̲::Vector, Hᵀ::AbstractArray{Int}, n::Int) -> Matrix{Int}

Calculates the syndrome of a given word v̲ and a parity check matrix, transposed (Hᵀ), under modulo n.

Parameters:

  • v̲::Vector: A word in the code.
  • Hᵀ::AbstractArray{Int}: The transpose of a parity check matrix.

Returns:

  • Vector: The syndrome of a word in the code.

Examples

julia> syndrome([0, 2, 1, 2, 0, 1, 0], [1 1 1; 1 0 2; 2 0 1; 1 1 2; 1 0 0; 0 1 0; 0 0 1], 3)
 1×3 Array{Int64,2}:
 0  0  0
 
 julia> syndrome([0, 2, 1, 2, 0, 1, 0], transpose(parity_check([1 0 0 0 2 2 2; 0 1 0 0 2 0 1; 0 0 1 0 1 0 2; 0 0 0 1 2 2 1], 3)), 3)
 1×3 Array{Int64,2}:
- 0  0  0
source
CodingTheory.t_error_correctingMethod
t_error_correcting(C::AbstractArray{T}, t::Int) -> Bool

Check if a given code C can correct t many errors.

Parameters:

  • C::AbstractArray: An array of words in the code.
  • t::Int: The number of errors you want to check that the code can correct.

Returns:

  • Bool: Yes, C can correct t errors, or no it cannot (true of false).
source
CodingTheory.t_error_detectingMethod
t_error_detecting(C::AbstractArray{T}, t::Int) -> Bool

Check if a given code C can detect t many errors.

Parameters:

  • C::AbstractArray: An array of words in the code.
  • t::Int: The number of errors you want to check that the code can detect.

Returns:

  • Bool: Yes, C can detect t errors, or no it cannot (true of false).

Examples

julia> t_error_detecting([[1, 0, 1], [0, 1, 1], [1, 0, 0]], 3)
-false
source

Index

+ 0 0 0source
CodingTheory.t_error_correctingMethod
t_error_correcting(C::AbstractArray{T}, t::Int) -> Bool

Check if a given code C can correct t many errors.

Parameters:

  • C::AbstractArray: An array of words in the code.
  • t::Int: The number of errors you want to check that the code can correct.

Returns:

  • Bool: Yes, C can correct t errors, or no it cannot (true of false).
source
CodingTheory.t_error_detectingMethod
t_error_detecting(C::AbstractArray{T}, t::Int) -> Bool

Check if a given code C can detect t many errors.

Parameters:

  • C::AbstractArray: An array of words in the code.
  • t::Int: The number of errors you want to check that the code can detect.

Returns:

  • Bool: Yes, C can detect t errors, or no it cannot (true of false).

Examples

julia> t_error_detecting([[1, 0, 1], [0, 1, 1], [1, 0, 0]], 3)
+false
source

Index