The operations described here produce a new code by modifying in some way the code words of a given code.
For the following operators, C and D are codes defined as subsets (or subspaces) of the same R-space V.
The (vector space) sum of the linear codes C and D, where C and D are contained in the same R-space V.
The intersection of the linear codes C and D, where C and D are contained in the same R-space V.
The dual D of the linear code C. The dual consists of all codewords in the R-space V which are orthogonal to all codewords of C.
> R<w> := GR(9,2);
> P<x> := PolynomialRing(R);
> g := x^2 + 7*w*x + 1;
> C := CyclicCode(5, g);
> C;
(5, 43046721) Cyclic Code over GaloisRing(3, 2, 2)
Generator matrix:
[ 1 0 0 1 w]
[ 0 1 0 2*w 2*w]
[ 0 0 1 w 1]
[ 0 0 0 3 0]
[ 0 0 0 0 3]
>
> C1 := sub< C | C.1 >;
> C1;
(5, 81, 3) Linear Code over GaloisRing(3, 2, 2)
Generator matrix:
[1 0 0 1 w]
> C2 := sub< C | C.4 >;
> C2;
(5, 9, 1) Linear Code over GaloisRing(3, 2, 2)
Generator matrix:
[0 0 0 3 0]
> C3 := sub< C | { C.1 , C.4} >;
> C3;
(5, 729, 1) Linear Code over GaloisRing(3, 2, 2)
Generator matrix:
[1 0 0 1 w]
[0 0 0 3 0]
> (C1 + C2) eq C3;
true
> (C1 meet C3) eq C1;
true
Given a length n1 code C and a length n2 code D, both over the same ring R, construct the direct sum of C and D. The direct sum consists of all length n1 + n2 vectors u|v, where u ∈C and v ∈D.
Given a length n1 code C and a length n2 code D, both over the same ring R, construct the direct product of C and D. The direct product has length n1.n2 and its generator matrix is the Kronecker product of the basis matrices of C and D.
Given codes C1 and C2, both defined over the same ring R, return the concatenation C of C1 and C2. If A and B are the generator matrices of C1 and C2, respectively, the concatenation of C1 and C2 is the code with generator matrix whose rows consist of each row of A concatenated with each row of B.
Given a length n code C form a new code C' from C by adding the appropriate extra coordinate to each vector of C such that the sum of the coordinates of the extended vector is zero.
Return the code C extended n times.
Add n zeros to the end of each codeword of C.
Given codes C and D both over the same ring R and of the same length n, construct the Plotkin sum of C and D. The Plotkin sum consists of all vectors u|u + v, u ∈C and v ∈D.
Given a length n code C, and an integer i, 1 ≤i ≤n, construct a new code C' by deleting the i-th coordinate from each code word of C.
Given a length n code C and a set S of distinct integers { i1, ..., ir } each of which lies in the range [1, n], construct a new code C' by deleting the components i1, ..., ir from each code word of C.
Given a length n code C and an integer i, 1 ≤i ≤n, construct a new code from C by selecting only those codewords of C having a zero as their i-th component and deleting the i-th component from these codewords. Thus, the resulting code will have length n - 1.
Given a length n code C and a set S of distinct integers { i1, ..., ir}, each of which lies in the range [1, n], construct a new code from C by selecting only those codewords of C having zeros in each of the coordinate positions i1, ..., ir, and deleting these components. Thus, the resulting code will have length n - r.
> R<w> := GR(8,2); > C1 := RandomLinearCode(R, 4, 2); > C2 := RandomLinearCode(R, 5, 3); > Length(C1); 4 > Length(C2); 5 > C3 := DirectSum(C1, C2); > Length(C3); 9 > C4 := DirectProduct(C1, C2); > Length(C4); 20 > C5 := C1 cat C2; > Length(C5); 9
> C := PreparataCode(3); > C; (8, 256, 4) Linear Code over IntegerRing(4) Generator matrix: [1 0 0 0 3 1 2 1] [0 1 0 0 2 1 1 3] [0 0 1 0 1 1 3 2] [0 0 0 1 3 2 3 3] > MinimumLeeWeight(C); 6 > C1 := PunctureCode(C,8); > C1; (7, 256, 3) Linear Code over IntegerRing(4) Generator matrix: [1 0 0 0 3 1 2] [0 1 0 0 2 1 1] [0 0 1 0 1 1 3] [0 0 0 1 3 2 3] > MinimumLeeWeight(C1); 4