New Codes From Old

Combining two or more codes

u_u_plus_v and u_plus_w_v_plus_w_u_plus_v_plus_w throw an error when one of the arguments is the zero code. For the latter, let C1 be an $[n, k_1, d_1]$ and C2 an $[n, k_2, d_2]$ linear code; the construction produces an $[3n, 2k_1 + k_2]$ linear code, and for binary codes

\[\mathrm{wt}(u + w \mid v + w \mid u + v + w) = 2\,\mathrm{wt}(u \veebar v) - \mathrm{wt}(w) + 4s, \qquad s = |\{i \mid u_i = v_i = 0,\, w_i = 1\}|.\]

Construction X takes an $[n, k, d]$ code C1, an $[n, k - l, d + e]$ code C2, and an $[m, l, e]$ code C3 with C2 a proper subcode of C1, and returns an $[n + m, k, d + e]$ code. Construction X3 takes $[n, k_1, d_1]$, $[n, k_2, d_2]$, $[n, k_3, d_3]$, $[n_4, k_2 - k_1, d_4]$, and $[n_5, k_3 - k_2, d_5]$ codes with C1 ⊂ C2 ⊂ C3 and returns an $[n + n_4 + n_5, k_3, d]$ code with $d \geq \min\{d_1, d_2 + d_4, d_3 + d_5\}$.

The direct sum ⊕ has generator matrix G1 ⊕ G2 and parity-check matrix H1 ⊕ H2. The generator matrix of the direct product × is the Kronecker product of the input generator matrices, and the parity-check matrix of the tensor product is the Kronecker product of the input parity-check matrices. There is some debate over how to define the entrywise (Schur) product of two codes; the result is known to often be the full ambient space.

juxtaposition is representation dependent and therefore works on the potentially overcomplete generator matrices rather than on the standard form.

Modifying a single code

Extending adds a column to the generator matrix whose values make the row sums zero. This even extension is the default for extend(C), and the new column may instead be inserted at any index with extend(C, c). In the general case one supplies a vector a and the new entries are the negated inner products of a with the rows; the standard definition is the special case where a is the all-ones vector.

Puncturing deletes columns from the generator matrix and removes any resulting zero rows. Expurgating deletes rows and removes any resulting zero columns, working directly on the potentially overcomplete generator matrix rather than the standard form. Shortening is expurgating followed by puncturing; the implementation uses the theorem that the code shortened on L is the dual of the dual punctured on L, that is dual(puncture(dual(C), L)).

Augmentation vertically joins a matrix to the bottom of the generator matrix, again working on the potentially overcomplete form. Lengthening augments the all-ones row and then extends.

subcode_of_dimension_between_codes adds generators of C1 / C2 to C2 until the desired dimension is reached. The subfield subcode is computed directly via an expansion, whereas the trace code is computed using Delsarte's theorem.

If C is a quasi-cyclic code, permute_code returns a LinearCode.

Experimental

even_subcode, doubly_even_subcode, and triply_even_subcode need significantly more testing, but appear to work so far.

Base.:/ — Method
/(
    C2::AbstractLinearCode,
    C1::AbstractLinearCode
) -> LinearCode

Return the complementary subcode C2 / C1 given C1 ⊆ C2.

source
CodingTheory.:× — Method
×(
    C1::AbstractLinearCode,
    C2::AbstractLinearCode
) -> CodingTheory.TensorProductCode

Return the (direct) product code of C1 and C2 (Tensor product of their generator matrices). Evaluates lazily.

source
CodingTheory.Plotkin_construction — Method
Plotkin_construction(
    C1::AbstractLinearCode,
    C2::AbstractLinearCode
) -> CodingTheory.PlotkinCode

Return the Plotkin $(u \mid u + v)$ construction of C1 and C2, an $[2n, k_1 + k_2, \min(2d_1, d_2)]$ code when both inputs have length $n$. This is an alias for u_u_plus_v.

source
CodingTheory.augment — Method
augment(
    C::AbstractLinearCode,
    M::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC}
) -> LinearCode

Return the code of C whose generator matrix is augmented with M.

source
CodingTheory.code_complement — Method
code_complement(
    C2::AbstractLinearCode,
    C1::AbstractLinearCode
) -> LinearCode

Return a complement of the subcode C2 in the supercode C1, representing C1 / C2. The result has length $n$ and dimension $k_1 - k_2$.

source
CodingTheory.construction_A — Method
construction_A(
    C::AbstractLinearCode,
    c::Union{Vector{Int64}, Vector{<:AbstractAlgebra.FinFieldElem}}
) -> Union{AbstractLinearCode, AbstractSubsystemCode}

Return the residue code of C with respect to a codeword c (Construction A). If c has weight w, this produces an [n - w, k - 1, d'] code where d' >= d - w + w / q.

source
CodingTheory.construction_B — Method
construction_B(
    C::AbstractLinearCode,
    h::Union{Vector{Int64}, Vector{<:AbstractAlgebra.FinFieldElem}}
) -> Any

Return the code obtained by applying Construction B (also known as Construction Y1) using a codeword h of the dual code. Shortens C on the support of h, dropping the dimension by s - 1 instead of s.

source
CodingTheory.construction_B2 — Method
construction_B2(
    C::AbstractLinearCode,
    h::Union{Vector{Int64}, Vector{<:AbstractAlgebra.FinFieldElem}},
    j::Int64
) -> Union{AbstractLinearCode, AbstractSubsystemCode}

Return the code obtained by applying Construction B2 to a binary code C using a dual codeword h of weight s and a parameter j such that 2j + 1 < s.

source
CodingTheory.construction_X — Method
construction_X(
    C1::AbstractLinearCode,
    C2::AbstractLinearCode,
    C3::AbstractLinearCode
) -> LinearCode

Return the code generated by the construction X procedure.

source
CodingTheory.construction_X3 — Method
construction_X3(
    C1::AbstractLinearCode,
    C2::AbstractLinearCode,
    C3::AbstractLinearCode,
    C4::AbstractLinearCode,
    C5::AbstractLinearCode
) -> LinearCode

Return the code generated by the construction X3 procedure.

source
CodingTheory.construction_Y — Method
construction_Y(C::AbstractLinearCode, h) -> Any

Return Construction Y applied to C using the dual codeword h. This is an alias for construction_B and hence for construction_Y1.

source
CodingTheory.construction_Y1 — Method
construction_Y1(C::AbstractLinearCode, h) -> Any

Return Construction Y1 (Construction B) applied to C using the dual codeword h. If $s = \operatorname{wt}(h)$, the result has length $n - s$, dimension at least $k - s + 1$, and preserves the distance lower bound of C. This is an alias for construction_B.

source
CodingTheory.direct_product — Method
direct_product(
    C1::AbstractLinearCode,
    C2::AbstractLinearCode
) -> CodingTheory.TensorProductCode

Return the product code of C1 and C2, with generator matrix $G_1 \otimes G_2$ and parameters $[n_1 n_2, k_1 k_2, d_1 d_2]$ when both distances are known. This is an alias for ×.

source
CodingTheory.entrywise_product_code — Method
entrywise_product_code(
    C::AbstractLinearCode,
    D::AbstractLinearCode
) -> Union{BCHCode, CyclicCode, ReedSolomonCode}

Return the entrywise (Schur) product of C and D.

source
CodingTheory.even_extension — Method
even_extension(C::AbstractLinearCode) -> LinearCode

Return the length $n + 1$, dimension $k$ extension of C obtained by appending a coordinate that makes every codeword's coordinate sum zero. This is an alias for extend(C).

source
CodingTheory.expanded_code — Method
expanded_code(
    C::AbstractLinearCode,
    K::AbstractAlgebra.FinField,
    β::Vector{<:AbstractAlgebra.FinFieldElem}
) -> LinearCode

Return the expanded code of C constructed by expanding the generator matrix to the subfield K using the basis β for field(C) over K.

source
CodingTheory.expurgate — Method
expurgate(
    C::AbstractLinearCode,
    rows::Vector{<:Integer}
) -> AbstractLinearCode

Return the code of C expurgated at the rows in rows.

source
CodingTheory.juxtaposition — Method
juxtaposition(
    C1::AbstractLinearCode,
    C2::AbstractLinearCode
) -> LinearCode

Return the code generated by the horizontal concatenation of the generator matrices of C1 then C2.

source
CodingTheory.permute_code — Method
permute_code(
    C::AbstractLinearCode,
    σ::Union{AbstractAlgebra.Perm{Int64}, Oscar.PermGroupElem, Vector{Int64}}
) -> LinearCode

Return the code whose generator matrix is C's with the columns permuted by σ.

source
CodingTheory.product_code — Method
product_code(
    C1::AbstractLinearCode,
    C2::AbstractLinearCode
) -> CodingTheory.TensorProductCode

Return the product code of C1 and C2, with generator matrix $G_1 \otimes G_2$ and parameters $[n_1 n_2, k_1 k_2, d_1 d_2]$ when both distances are known. This is an alias for direct_product and ×.

source
CodingTheory.puncture — Method
puncture(
    C::AbstractLinearCode,
    cols::Vector{<:Integer}
) -> AbstractLinearCode

Return the code of C punctured at the columns in cols.

source
CodingTheory.quotient — Method
quotient(
    C1::AbstractLinearCode,
    C2::AbstractLinearCode
) -> LinearCode

Return a complementary subcode representing C1 / C2, where C2 ⊆ C1. The result has length $n$ and dimension $k_1 - k_2$. This is an alias for /.

source
CodingTheory.residue_code — Method
residue_code(
    C::AbstractLinearCode,
    c
) -> Union{AbstractLinearCode, AbstractSubsystemCode}

Return the residue code from Construction A applied to C and its nonzero codeword c. If c has weight $w$, the result has length $n - w$, dimension $k - 1$, and lower bound $d - w + \lceil w/q \rceil$. This is an alias for construction_A.

source
CodingTheory.shorten — Method
shorten(C::AbstractLinearCode, L::Vector{<:Integer}) -> Any

Return the code of C shortened on the indices L.

source
CodingTheory.subcode — Method
subcode(
    C::AbstractLinearCode,
    k::Int64
) -> AbstractLinearCode

Return a k-dimensional subcode of C.

source
CodingTheory.subcode — Method
subcode(
    C::AbstractLinearCode,
    rows::Vector{Int64}
) -> AbstractLinearCode

Return a subcode of C using the rows of the generator matrix of C listed in rows.

source
CodingTheory.subfield_subcode — Method
subfield_subcode(
    C::AbstractLinearCode,
    K::AbstractAlgebra.FinField,
    basis::Vector{<:AbstractAlgebra.FinFieldElem}
) -> LinearCode

Return the subfield subcode code of C over K using the provided dual basis for the field of C over K.

source
CodingTheory.trace_code — Method
trace_code(
    C::AbstractLinearCode,
    K::AbstractAlgebra.FinField,
    basis::Vector{<:AbstractAlgebra.FinFieldElem}
) -> LinearCode

Return the trace code of C over K using the provided dual basis for the field of C over K using Delsarte's theorem.

source
CodingTheory.triply_even_subcode — Method
triply_even_subcode(
    C::AbstractLinearCode
) -> Union{Missing, LinearCode}

Return a maximal triply-even subcode of C. Because the triply-even condition defines a cubic form over GF(2), the maximal subcode is not strictly unique. This returns the first maximal subspace found.

source
CodingTheory.u_u_plus_v — Method
u_u_plus_v(
    C1::AbstractLinearCode,
    C2::AbstractLinearCode
) -> CodingTheory.PlotkinCode

Return the Plotkin (u | u + v)-construction with u ∈ C1 and v ∈ C2. Evaluates lazily without eagerly building the generator matrices.

source
Hecke.:⊕ — Method
⊕(
    C1::AbstractLinearCode,
    C2::AbstractLinearCode
) -> CodingTheory.DirectSumCode

Return the direct sum code of C1 and C2. Evaluates lazily.

source
Hecke.extend — Method
extend(
    C::AbstractLinearCode,
    a::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC},
    c::Integer
) -> LinearCode

Return the extended code of C extending on column c. For each row g of the generator matrix for C, a digit -a ⋅ g is inserted in the cth position. If c isn't given, it is appended. If a isn't given, then the all 1's vector is used giving an even extension.

source

Weight reduction

Weight reduction rewrites a parity-check matrix so that its row and column weights meet a target, at the cost of extra rows and columns. See the weight reduction tutorial for a detailed explanation.

CodingTheory.weight_reduction — Method
weight_reduction(
    C::AbstractLinearCode;
    rows,
    row_indices,
    permute_rows,
    row_target,
    columns,
    column_indices,
    permute_columns,
    column_target,
    compressed,
    seed
) -> Union{LinearCode, QuasiCyclicCode}

Return the code whose parity-check matrix is the weight reduction of the parity-check matrix of C. The keyword arguments are those of weight_reduction for a matrix.

Notes

  • A QuasiCyclicCode input returns a QuasiCyclicCode, another AbstractLinearCode returns a LinearCode, and an AbstractLDPCCode returns an LDPCCode.
source
CodingTheory.weight_reduction — Method
weight_reduction(
    H::Union{Nemo.FqMatrix, Nemo.fpMatrix, AbstractAlgebra.MatElem{<:AbstractAlgebra.ResElem}, Hecke.SMat, SparseArrays.SparseMatrixCSC};
    rows,
    row_indices,
    permute_rows,
    row_target,
    columns,
    column_indices,
    permute_columns,
    column_target,
    compressed,
    seed
) -> Any

Return the weight-reduced parity-check matrix of H.

Keyword arguments

  • rows: reduce row weights, true by default.
  • row_indices: the rows to reduce. When empty, every row of weight greater than row_target is reduced.
  • permute_rows: randomly permute the rows introduced by each reduction, true by default.
  • row_target: the target row weight, 3 by default.
  • columns, column_indices, permute_columns, column_target: the same options applied to the columns of the row-reduced matrix.
  • compressed: use the compressed reduction, which adds fewer rows and columns. Only implemented for a target weight of 3.
  • seed: seed for the permutations, for reproducible output.
source