65.48 CodewordNr

CodewordNr( C, list )

CodewordNr returns a list of codewords of C. list may be a list of integers or a single integer. For each integer of list, the corresponding codeword of C is returned. The correspondence of a number i with a codeword is determined as follows: if a list of elements of C is available, the i^{th} element is taken. Otherwise, it is calculated by multiplication of the i^{th} information vector by the generator matrix or generator polynomial, where the information vectors are ordered lexicographically.

So CodewordNr(C, i) is equal to Elements(C)[i]. The latter function first calculates the set of all the elements of C and then returns the i^{th} element of that set, whereas the former only calculates the i^{th} codeword.

    gap> R := ReedSolomonCode(2,2);
    a cyclic [2,1,2]1 Reed-Solomon code over GF(3)
    gap> Elements(R);
    [ 0, x + 1, 2x + 2 ]
    gap> CodewordNr(R, [1,3]);
    [ 0, 2x + 2 ]
    gap> C := HadamardCode( 16 );
    a (16,32,8)5..6 Hadamard code of order 16 over GF(2)
    gap> Elements(C)[17] = CodewordNr( C, 17 );
    true 

Previous Up Top Next
Index

GAP 3.4.4
April 1997