Create the K-additive code in F(n) of length n which is generated by the elements specified by the list L, where K is a subfield of F and L is one or more items of the following types:
- (a)
- An element of F(n);
- (b)
- A set or sequence of elements of F(n);
- (c)
- A sequence of n elements of F, defining an element of F(n);
- (d)
- A set or sequence of sequences of type (c);
- (e)
- A subcode of F(n);
Given a matrix G over a field F and a subfield K of F, return the K-additive code over F generated by the rows of G. If no coefficient field K is specified, then the prime field of F is used.
> F<w> := GF(4); > G := Matrix(F, 2, 3, [1,0,w^2,0,w,0]); > G; [ 1 0 w^2] [ 0 w 0] > C1 := LinearCode(G); > C2 := AdditiveCode(GF(2), G); > #C1; 16 > #C2; 4 > C2 subset C1; trueThe codewords of C2 are arise only through addition of the generators: scalar multiplication is not permitted.
> { v : v in C2 }; { ( 1 w w^2), ( 0 0 0), ( 1 0 w^2), ( 0 w 0) }
> K<w> := GF(8); > M := KMatrixSpace(K, 5, 4); > C := AdditiveCode(GF(2), Random(M)); > C; [4, 1 2/3 : 5] GF(2)-Additive Code over GF(2^3) Generator matrix: [ 1 1 w^2 0] [ w w^2 w 1] [w^2 w^2 w^2 1] [ 0 w^4 w^4 w^5] [ 0 0 1 0] > WeightDistribution(C); [ <0, 1>, <1, 1>, <2, 2>, <3, 9>, <4, 19> ] > C; [4, 1 2/3 : 5, 1] GF(2)-Additive Code over GF(2^3) Generator matrix: [ 1 1 w^2 0] [ w w^2 w 1] [w^2 w^2 w^2 1] [ 0 w^4 w^4 w^5] [ 0 0 1 0]
Given a code (linear or additive) C over some finite field F, and a subfield K of F such that the wordset of C forms a K-linear subspace, then return C as a K-additive code.
> C := RandomLinearCode(GF(4), 8, 3); > C:Minimal; [8, 3, 4] Linear Code over GF(2^2) > A1 := AdditiveCode(GF(4), C); > A1:Minimal; [8, 3 : 3, 4] GF(2^2)-Additive Code over GF(2^2) > { v : v in C } eq {v : v in A1 }; true > > A2 := AdditiveCode(GF(2), C); > A2:Minimal; [8, 3 : 6, 4] GF(2)-Additive Code over GF(2^2) > { v : v in C } eq {v : v in A2 }; true
> C4 := RandomAdditiveCode(GF(16), GF(4), 8, 5); > C4:Minimal; [8, 2 1/2 : 5] GF(2^2)-Additive Code over GF(2^4) > > C2 := AdditiveCode(GF(2), C4); > C2:Minimal; [8, 2 1/2 : 10] GF(2)-Additive Code over GF(2^4) > { v : v in C2 } eq {v : v in C4 }; trueBut for any E such that K ⊂E ⊆F we can create an E-additive code if and only if the wordset is in fact an E-linear subspace.
> C2:Minimal; [8, 2 1/2 : 10] GF(2)-Additive Code over GF(2^4) > A1 := AdditiveCode(GF(4), C2); > A1 eq C4; true
> A2 := AdditiveCode(GF(16), C2); >> A2 := AdditiveCode(GF(16), C2); ^ Runtime error in 'AdditiveCode': Code is not additive over given field
Given a field F and subfield K ⊆F along with a positive integer n, return the [n, 0, n] code consisting of only the zero code word, (where the minimum weight is by convention equal to n).
Given a field F and subfield K ⊆F along with a positive integer n, return the [n, 1, n] code consisting of all repeating codewords.
Given a field F and subfield K ⊆F along with a positive integer n, return the [n, n - 1, 2] K-additive code over F such that for all codewords (c1, c2, ... , cn), we have ∑i ci =0 .
Given a field F and subfield K ⊆F along with a positive integer n, return the [n, n, 1] K-additive code over F consisting of all possible codewords.
Given a field F and subfield K ⊆F along with positive integers n and k, such that 0 < k ≤n * [F:K], and k, return a random K-additive code of length n and k generators over the field F.
> F := GF(9); > K := GF(3); > U := AdditiveUniverseCode(F, K, 5); > Z := AdditiveZeroCode(F, K, 5); > R := RandomAdditiveCode(F, K, 5, 2); > (Z subset R) and (R subset U); true