Subcodes
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 \le 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 \(C_1\) and a subcode \(C_2\) of \(C_1\), return a subcode of \(C_1\) of dimension \(k\) containing \(C_2\).
- 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: Subcode between Two Codes (ex-db10dc)
Run in calculator (opens in a new tab)
We give an example of how
SubcodeBetweenCodemay 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: Sums and Intersections of Subcodes (ex-377d6d)
Run in calculator (opens in a new tab)
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: Dual of a Reed-Solomon Code (ex-cfd60d)
Run in calculator (opens in a new tab)
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.
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
trueif and only if the vector \(u\) of \(V\) belongs to the code \(C\).
- u notin C: ModTupRngElt, Code -> BoolElt
Return
trueif and only if the vector \(u\) of \(V\) does not belong to the code \(C\).
- C subset D: Code, Code -> BoolElt
Return
trueif and only if the code \(C\) is a subcode of the code \(D\).