06.09.2014 Views

guava - Gap

guava - Gap

guava - Gap

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

GUAVA 20<br />

a cyclic [2,1,2]1 Reed-Solomon code over GF(3)<br />

gap> AsSSortedList(R);<br />

[ [ 0 0 ], [ 1 1 ], [ 2 2 ] ]<br />

gap> CodewordNr(R, [1,3]);<br />

[ [ 0 0 ], [ 2 2 ] ]<br />

3.1.3 IsCodeword<br />

♦ IsCodeword(obj)<br />

(function)<br />

IsCodeword returns ‘true’ if obj, which can be an object of arbitrary type, is of the codeword<br />

type and ‘false’ otherwise. The function will signal an error if obj is an unbound variable.<br />

Example<br />

gap> IsCodeword(1);<br />

false<br />

gap> IsCodeword(ReedMullerCode(2,3));<br />

false<br />

gap> IsCodeword("11111");<br />

false<br />

gap> IsCodeword(Codeword("11111"));<br />

true<br />

3.2 Comparisons of Codewords<br />

3.2.1 =<br />

♦ =(c1, c2)<br />

(function)<br />

The equality operator c1 = c2 evaluates to ‘true’ if the codewords c1 and c2 are equal, and to<br />

‘false’ otherwise. Note that codewords are equal if and only if their base vectors are equal. Whether<br />

they are represented as a vector or polynomial has nothing to do with the comparison.<br />

Comparing codewords with objects of other types is not recommended, although it is possible. If<br />

c2 is the codeword, the other object c1 is first converted to a codeword, after which comparison is<br />

possible. This way, a codeword can be compared with a vector, polynomial, or string. If c1 is the<br />

codeword, then problems may arise if c2 is a polynomial. In that case, the comparison always yields<br />

a ‘false’, because the polynomial comparison is called.<br />

The equality operator is also denoted EQ, and EQ(c1,c2) is the same as c1 = c2. There is also<br />

an inequality operator, < >, or not EQ.<br />

Example<br />

gap> P := UnivariatePolynomial(GF(2), Z(2)*[1,0,0,1]);<br />

Z(2)ˆ0+x_1ˆ3<br />

gap> c := Codeword(P, GF(2));<br />

xˆ3 + 1<br />

gap> P = c; # codeword operation<br />

true<br />

gap> c2 := Codeword("1001", GF(2));<br />

[ 1 0 0 1 ]<br />

gap> c = c2;<br />

true

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!