> < ^ Date: Tue, 07 Sep 1999 13:20:13 +0100 (BST)
> < ^ From: Alexander Hulpke <hulpke@math.colostate.edu >
^ Subject: Re: splitting up codeword

Dear Gap-Forum,

Matthias Frey asked:

I am a novice user of GAP and GUAVA and I am trying to figure
out how to split up a 24-bit codeword into pieces of 8 bit.

(Disclaimer; i'm not the author of GUAVA. The following is undocumented but
seems to work. However I can't claim that this is a supported usage.)

The `.vector' field of a codeword gives the vector representation. You can
use the sublist operator to get parts of it and you can then again form
codewords from them. So for example you could use:

gap> w:=Codeword(co.generatorMat[1]); # define a codeword
[ 1 0 1 0 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 ]
gap> ran1:=[1..8];;ran2:=[9..16];;ran3:=[17..24];;
gap> Codeword(w.vector{ran1}); # you might want to give the field as well if
                               # it is not GF(p).
[ 1 0 1 0 1 1 1 0 ]
gap> Codeword(w.vector{ran2});
[ 0 0 1 1 0 0 0 0 ]
gap> Codeword(w.vector{ran3});
[ 0 0 0 0 0 0 0 1 ]

(As GUAVA so far is only released for GAP3 this information is GAP3
specific, in a future GAP4 version this might change.)

I hope this is of help,

Alexander Hulpke


> < [top]