C_1 + C_2
The operator +
evaluates to the direct sum of the codes C_1 and
C_2. See DirectSumCode.
C + c
c + C
The operator +
evaluates to the coset code of code C after adding c
to all elements of C. See CosetCode.
C_1 * C_2
The operator *
evaluates to the direct product of the codes C_1
and C_2. See DirectProductCode.
x * C
The operator *
evaluates to the element of C belonging to
information word x. x may be a vector, polynomial, string or codeword
or a list of those. This is the way to do encoding in GUAVA. C must
be linear, because in GUAVA, encoding by multiplication is only
defined for linear codes. If C is a cyclic code, this multiplication
is the same as multiplying an information polynomial x by the generator
polynomial of C (except for the result not being a codeword type). If
C is a linear code, it is equal to the multiplication of an information
vector x by the generator matrix of C (again, the result then is not
a codeword type).
To decode, use the function Decode
(see Decode).
c in C
The in
operator evaluates to true
if C contains the codeword or
list of codewords specified by c. Of course, c and C must have the
same word lengths and base fields.
gap> C := HammingCode( 2 );; Elements( C ); [ [ 0 0 0 ], [ 1 1 1 ] ] gap> [ [ 0, 0, 0, ], [ 1, 1, 1, ] ] in C; true gap> [ 0 ] in C; false
C_1 in C_2
The in
operator evaluates to true
if C_1 is a subcode of C_2,
i.e. if C_2 contains at least all the elements of C_1.
gap> RepetitionCode( 7 ) in HammingCode( 3 ); true gap> HammingCode( 3 ) in RepetitionCode( 7 ); false gap> HammingCode( 3 ) in WholeSpaceCode( 7 ); true gap> AreEqualCodes := function(C1, C2) > return (C1 in C2) and (C2 in C1); > end; #this is a slow implementation of the function '=' function ( C1, C2 ) ... end gap> AreEqualCodes( HammingCode(2), RepetitionCode(3) ); true
GAP 3.4.4