c_1 = c_2
c_1 < c_2
The equality operator =
evaluates to true
if the codewords c_1
and c_2 are equal, and to false
otherwise. The inequality operator
<
evaluates to true
if the codewords c_1 and c_2 are not
equal, and to false
otherwise.
Note that codewords are equal if and only if their base vectors are equal. Whether they are represented as a vector or polynomial has nothing to do with the comparison.
Comparing codewords with objects of other types is not recommended,
although it is possible. If c_2 is the codeword, the other object
c_1 is first converted to a codeword, after which comparison is
possible. This way, a codeword can be compared with a vector, polynomial,
or string. If c_1 is the codeword, then problems may arise if c_2
is a polynomial. In that case, the comparison always yields a false
,
because the polynomial comparison is called (see Comparisons of
Polynomials
).
gap> P := Polynomial(GF(2), Z(2)*[1,0,0,1]); Z(2)^0*(X(GF(2))^3 + 1) gap> c := Codeword(P, GF(2)); x^3 + 1 gap> P = c; # codeword operation true gap> c = P; # polynomial operation false gap> c2 := Codeword("1001", GF(2)); [ 1 0 0 1 ] gap> c = c2; true
GAP 3.4.4