The following operations are always available for codewords. The operands must have a common base field, and must have the same length. No implicit conversions are performed.
c_1 + c_2
The operator +
evaluates to the sum of the codewords c_1 and
c_2.
c_1 - c_2
The operator -
evaluates to the difference of the codewords c_1 and
c_2.
C + c
c + C
The operator +
evaluates to the coset code of code C after adding a
codeword c to all codewords. See CosetCode.
In general, the operations just described can also be performed on
vectors, strings or polynomials, although this is not recommended. The
vector, string or polynomial is first converted to a codeword, after
which the normal operation is performed. For this to go right, make sure
that at least one of the operands is a codeword. Further more, it will
not work when the right operand is a polynomial. In that case, the
polynomial operations (FiniteFieldPolynomialOps
) are called, instead of
the codeword operations (CodewordOps
).
Some other code-oriented operations with codewords are described in Operations for Codes.
GAP 3.4.4