Modifying Codes
Constructors
The first two constructors throw an error when one of the arguments is the zero code.
CodingTheory.u_u_plus_v
— Functionu_u_plus_v(C1::AbstractLinearCode, C2::AbstractLinearCode)
Plotkin_construction(C1::AbstractLinearCode, C2::AbstractLinearCode)
Return the Plotkin (u | u + v)-construction with u ∈ C1
and v ∈ C2
.
Let C1
be an $[n, k1, d1]$ and C2
an $[n, k2, d2]$ linear code. This construction produces an $[3n, 2k1 + k2]$ linear code. For binary codes, $\mathrm{wt}(u + w \mid v + w \mid u + v + w) = 2 \mathrm{wt}(u \veebar v) - \mathrm{wt}(w) + 4s$, where $s = |\{i \mid u_i = v_i = 0, w_i = 1\}|$.
CodingTheory.u_plus_w_v_plus_w_u_plus_v_plus_w
— Functionu_plus_w_v_plus_w_u_plus_v_plus_w(C1::AbstractLinearCode, C2::AbstractLinearCode)
Return the code generated by the (u + w | v + w | u + v + w)-construction.
Let C1
be an $[n, k, d]$, C2
an $[n, k - l, d + e]$, and C3
an $[m, l, e]$ linear code with C2 ⊂ C1
be proper. Construction X creates a $[n + m, k, d + e]$ linear code.
CodingTheory.construction_X
— Functionconstruction_X(C1::AbstractLinearCode, C2::AbstractLinearCode, C3::AbstractLinearCode)
Return the code generated by the construction X procedure.
Let C1
be an $[n, k1, d1]$, C2
an $[n, k2, d2]$, C3
an $[n, k3, d3]$, C4
an $[n4, k2 - k1, d4]$, and C5
an $[n5, k3 - k2, d5]$ linear code with C1 ⊂ C2 ⊂ C3
. Construction X3 creates an $[n + n4 + n5, k3, d]$ linear code with $d \geq \min\{d1, d2 + d4, d3 + d5\}$.
CodingTheory.construction_X3
— Functionconstruction_X3(C1::AbstractLinearCode, C2::AbstractLinearCode, C3::AbstractLinearCode,
C4::AbstractLinearCode, C5::AbstractLinearCode))
Return the code generated by the construction X3 procedure.
The direct sum code has generator matrix G1 ⊕ G2
and parity-check matrix H1 ⊕ H2
.
Missing docstring for CodingTheory.⊕
. Check Documenter's build log for details.
The generator matrix of the (direct) product code is the kronecker product of the generator matrices of the inputs.
Missing docstring for CodingTheory.×
. Check Documenter's build log for details.
The parity-check matrix of the tensor product code is the kronecker product of the parity-check matrices of the inputs.
Missing docstring for CodingTheory.⊗
. Check Documenter's build log for details.
There is some debate on how to define this product. This is known to often be the full ambient space.
CodingTheory.entrywise_product_code
— Functionentrywise_product_code(C::AbstractLinearCode, D::AbstractLinearCode)
*(C::AbstractLinearCode, D::AbstractLinearCode)
Schur_product_code(C::AbstractLinearCode, D::AbstractLinearCode)
Hadamard_product_code(C::AbstractLinearCode, D::AbstractLinearCode)
componentwise_product_code(C::AbstractLinearCode, D::AbstractLinearCode)
Return the entrywise product of C
and D
.
Missing docstring for CodingTheory./
. Check Documenter's build log for details.
juxtaposition
is representation dependent and therefore works on the potentially over-complete generator matrices, not on the standard form.
CodingTheory.juxtaposition
— Functionjuxtaposition(C1::AbstractLinearCode, C2::AbstractLinearCode)
Return the code generated by the horizontal concatenation of the generator matrices of C1
then C2
.
Methods
If C
is a quasi-cyclic code, permute_code
returns a LinearCode
object.
CodingTheory.permute_code
— Functionpermute_code(C::AbstractLinearCode, σ::Union{PermGroupElem, Perm{Int}, Vector{Int}})
Return the code whose generator matrix is C
's with the columns permuted by σ
.
The most common way to extend a code is to add an extra column to the generator matrix whose values make the sum of the rows zero. This is called an even extension and is the default for extend(C)
. Alternatively, this new column may be inserted at any index c
in the matrix, e.g. extend(C, c)
. In the most general case, one may provide a vector a
and define the values of the new column to be -a
dot the row. The standard definition is clearly just the special case that a
is the all-ones vector.
Hecke.extend
— Functionextend(C::AbstractLinearCode, a::CTMatrixTypes, c::Integer)
extend(C::AbstractLinearCode, c::Integer)
extend(C::AbstractLinearCode, a::CTMatrixTypes)
extend(C::AbstractLinearCode)
even_extension(C::AbstractLinearCode)
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 c
th 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.
Puncturing deletes columns from the generator matrix and then removes any potentially resulting zero rows.
CodingTheory.puncture
— Functionpuncture(C::AbstractLinearCode, cols::Vector{<:Integer})
puncture(C::AbstractLinearCode, cols::Integer)
Return the code of C
punctured at the columns in cols
.
Expurgating deletes rows from the generator matrix and then removes any potentially resulting zero columns. This function works directly on the potentially over-complete generator matrix and not on the standard form.
CodingTheory.expurgate
— Functionexpurgate(C::AbstractLinearCode, rows::Vector{<:Integer})
expurgate(C::AbstractLinearCode, rows::Integer)
Return the code of C
expuragated at the rows in rows
.
expurgate(S::AbstractStabilizerCode, rows::Vector{Int}; verbose::Bool = true, logs_alg::Symbol = :sys_eqs)
Return the code created by removing the stabilizers indexed by rows
.
Notes
- The goal of this function is to track how the logical operators update through this process. Here, the original logical pairs are kept and an appropriate number of new pairs are added.
Shortening is expurgating followed by puncturing. This implementation uses the theorem that the dual of code shortened on L
is equal to the puncture of the dual code on L
, i.e., dual(puncture(dual(C), L))
.
CodingTheory.shorten
— Functionshorten(C::AbstractLinearCode, L::Vector{<:Integer})
shorten(C::AbstractLinearCode, L::Integer)
Return the code of C
shortened on the indices L
.
Augmentation vertically joins the matrix M
to the bottom of the generator matrix of C
. This function works directly on the potentially over-complete generator matrix and not on the standard form.
CodingTheory.augment
— Functionaugment(C::AbstractLinearCode, M::CTMatrixTypes)
Return the code of C
whose generator matrix is augmented with M
.
augment(S::AbstractSubsystemCode, row::CTMatrixTypes; verbose::Bool = true, logs_alg::Symbol = :sys_eqs)
Return the code created by added row
to the stabilizers of S
.
Notes
- The goal of this function is to track how the logical operators update given the new stabilizer. The unaffected logical operators are kept during the update and only those which don't commute with the new stabilizer are recomputed.
Lengthening augments the all 1's row and then extends.
CodingTheory.lengthen
— Functionlengthen(C::AbstractLinearCode)
Return the lengthened code of C
.
CodingTheory.subcode
— Functionsubcode(C::AbstractLinearCode, k::Int)
Return a k
-dimensional subcode of C
.
subcode(C::AbstractLinearCode, rows::Vector{Int})
Return a subcode of C
using the rows of the generator matrix of C
listed in rows
.
This function arguments generators of C1 / C2
to C2
until the desired dimenion is reached.
CodingTheory.subcode_of_dimension_between_codes
— Functionsubcode_of_dimension_between_codes(C1::AbstractLinearCode, C2::AbstractLinearCode, k::Int)
Return a subcode of dimenion k
between C1
and C2
.
CodingTheory.expanded_code
— Functionexpanded_code(C::AbstractLinearCode, K::CTFieldTypes, β::Vector{<:CTFieldElem})
Return the expanded code of C
constructed by exapnding the generator matrix to the subfield K
using the basis β
for field(C)
over K
.
The subfield subcode is computed directly via an expansion, whereas the trace code is computed using Delsarte's theorem.
CodingTheory.subfield_subcode
— Functionsubfield_subcode(C::AbstractLinearCode, K::CTFieldTypes, basis::Vector{<:CTFieldElem})
Return the subfield subcode code of C
over K
using the provided dual basis
for the field of C
over K
.
CodingTheory.trace_code
— Functiontrace_code(C::AbstractLinearCode, K::CTFieldTypes, basis::Vector{<:CTFieldElem})
Return the trace code of C
over K
using the provided dual basis
for the field of C
over K
using Delsarte's theorem.
The next two functions need significantly more testing, but appear to work so far.
CodingTheory.even_subcode
— Functioneven_subcode(C::AbstractLinearCode)
Return the even subcode of C
.
CodingTheory.doubly_even_subcode
— Functiondoubly_even_subcode(C::AbstractLinearCode)
Return the doubly-even subcode of C
.
Weight reduction
See the weight reduction tutorial for a more detailed explanation of this function.
CodingTheory.weight_reduction
— Functionweightreduction(H::Union{CTMatrixTypes, MatElem{<: ResElem}}; rows::Bool = true, rowindices::AbstractVector{Int} = Int[], permuterows::Bool = true, rowtarget::Int = 3, columns::Bool = true, columnindices::AbstractVector{Int} = Int[], permutecolumns::Bool = true, column_target::Int = 3, compressed::Bool = false, seed::Union{Nothing, Int} = nothing)
Return the weight-reduced parity-check matrix of H
with the given arguments.
weightreduction(C::Union{AbstractLinearCode, AbstractLDPCCode}; rows::Bool = true, rowindices::AbstractVector{Int} = Int[], permuterows::Bool = true, rowtarget::Int = 3, columns::Bool = true, columnindices::AbstractVector{Int} = Int[], permutecolumns::Bool = true, column_target::Int = 3, compressed::Bool = false, seed::Union{Nothing, Int} = nothing)
Return the code with the weight-reduced parity-check matrix of C
with the given arguments.