Subcodes

Contents

The Subcode Constructor

sub<C | L> : Code, List -> Code
Given an [n, k] linear code C over R, construct the subcode of C, generated by the elements specified by the list L, where L is a list of one or more items of the following types:
(a)
An element of C;
(b)
A set or sequence of elements of C;
(c)
A sequence of n elements of R, defining an element of C;
(d)
A set or sequence of sequences of type (c);
(e)
A subcode of C;
Subcode(C, k) : Code, RngIntElt -> Code
Given an [n, k] linear code C and an integer t, 1 ≤t < n, return a subcode of C of dimension t.
Subcode(C, S) : Code, { RngIntElt } -> Code
Given an [n, k] linear code C and a set S of integers, each of which lies in the range [1, k], return the subcode of C generated by the basis elements whose positions appear in S.
SubcodeBetweenCode(C1, C2, k) : Code, Code, RngIntElt -> Code
Given a linear code C1 and a subcode C2 of C1, return a subcode of C1 of dimension k containing C2.
SubcodeWordsOfWeight(C, S) : Code, { RngIntElt } -> Code
Given an [n, k] linear code C and a set S of integers, each of which lies in the range [1, n], return the subcode of C generated by those words of C whose weights lie in S.

Example CodeFld_SubcodeBetweenCode (H161E14)

We give an example of how SubcodeBetweenCode may be used to create a code nested in between a subcode pair.
> C1 := RepetitionCode(GF(2),6);
> C1;
[6, 1, 6] Cyclic Code over GF(2)
Generator matrix:
[1 1 1 1 1 1]
> C3 := EvenWeightCode(6);
> C3;
[6, 5, 2] Linear Code over GF(2)
Generator matrix:
[1 0 0 0 0 1]
[0 1 0 0 0 1]
[0 0 1 0 0 1]
[0 0 0 1 0 1]
[0 0 0 0 1 1]
> C1 subset C3;
true
> C2 := SubcodeBetweenCode(C3, C1, 4);
> C2;
[6, 4, 2] Linear Code over GF(2)
Generator matrix:
[1 0 0 0 1 0]
[0 1 0 0 0 1]
[0 0 1 0 0 1]
[0 0 0 1 0 1]
> (C1 subset C2) and (C2 subset C3);
true

Sum, Intersection, Duals and Hulls

For the following operators, C and D are codes defined as subsets (or subspaces) of the same R-space V.

C + D : Code, Code -> Code
The (vector space) sum of the linear codes C and D, where C and D are contained in the same K-space V.
C meet D : Code, Code -> Code
The intersection of the linear codes C and D, where C and D are contained in the same K-space V.
Dual(C) : Code -> Code
The dual D of the linear code C. The dual consists of all codewords in the K-space V which are orthogonal to all codewords of C.

Example CodeFld_SumIntersection (H161E15)

Verify some simple results from the sum and intersection of subcodes with known basis.
> C := EvenWeightCode(5);
> C;
[5, 4, 2] Linear Code over GF(2)
Generator matrix:
[1 0 0 0 1]
[0 1 0 0 1]
[0 0 1 0 1]
[0 0 0 1 1]
> C1 := sub< C | C.1 >;
> C2 := sub< C | C.4 >;
> C3 := sub< C | { C.1 , C.4} >;
> (C1 + C2) eq C3;
true
> (C1 meet C3) eq C1;
true

Example CodeFld_DualRS (H161E16)

Verify the orthogonality of codewords in the dual for a ReedSolomonCode.
> K<w> := GF(8);
> R := ReedSolomonCode(K, 3);
> R;
[7, 5, 3] BCH code (d = 3, b = 1) over GF(2^3)
Generator matrix:
[  1   0   0   0   0 w^3 w^4]
[  0   1   0   0   0   1   1]
[  0   0   1   0   0 w^3 w^5]
[  0   0   0   1   0   w w^5]
[  0   0   0   0   1   w w^4]
> D := Dual(R);
> D;
[7, 2, 6] Cyclic Code over GF(2^3)
Generator matrix:
[  1   0 w^3   1 w^3   w   w]
[  0   1 w^4   1 w^5 w^5 w^4]
> {<u,v> : u in R, v in D | InnerProduct(u,v) ne 0};
HermitianDual(C) : CodeLinFld -> CodeLinFld
The Hermitian dual D of the linear code C. The Hermitian dual consists of all codewords in the K-space V which are orthogonal to all codewords of C with respect to the Hermitian inner product for quadratic extensions.
Hull(C) : CodeLinFld -> CodeLinFld
The (Euclidean) hull of the linear code C is the intersection of the code with its dual.
HermitianHull(C) : CodeLinFld -> CodeLinFld
The Hermitian hull of the linear code C is the intersection of the code with its Hermitian dual.

Membership and Equality

For the following operators, C and D are codes defined as a subset (or subspace) of the R-space V.

u in C : ModTupRngElt, Code -> BoolElt
Return true if and only if the vector u of V belongs to the code C.
u notin C : ModTupRngElt, Code -> BoolElt
Return true if and only if the vector u of V does not belong to the code C.
C subset D : Code, Code -> BoolElt
Return true if and only if the code C is a subcode of the code D.
C notsubset D : Code, Code -> BoolElt
Return true if and only if the code C is not a subcode of the code D.
C eq D : Code, Code -> BoolElt
Return true if and only if the codes C and D are equal.
C ne D : Code, Code -> BoolElt
Return true if and only if the codes C and D are not equal.
V2.28, 13 July 2023