Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
</Copyright>
<Acknowledgements> <!-- OPTIONAL -->
<P/>
<Package>GUAVA</Package> was originally written by Jasper Cramwinckel,
Erik Roijackers, and Reinald Baart in the early-to-mid
1990's as a final project during their study of Mathematics at the
Delft University of Technology, Department of Pure Mathematics,
under the direction of Professor Juriaan Simonis.
This work was continued in Aachen, at Lehrstuhl D fur Mathematik.
In version 1.3, new functions were added by Eric Minkes, also from Delft
University of Technology.
<P/>
JC, ER and RB would like to thank the GAP people at the RWTH Aachen for
their support, A.E. Brouwer for his advice and J. Simonis for his
supervision.
<P/>
The GAP 4 version of <Package>GUAVA</Package> (versions 1.4 and 1.5)
was created by Lea Ruscio and (from 2001, starting with version 1.6, to
early 2009) was maintained by David Joyner, who (with the
help of several students) added several new functions. Starting
with version 2.7, the ``best linear code''
tables for binary codes have been updated. From 2009,
starting with version 3.10, <Package>GUAVA</Package> has been maintained
by Joe Fields.
For further details, see the CHANGES file in the
<Package>GUAVA</Package> directory, also available at
<URL>https://gap-packages.github.io/guava/CHANGES.guava</URL>.
<P/>
<P/>This documentation was prepared with the
<Package>GAPDoc</Package> package of Frank Lübeck and Max Neunhöffer.
The conversion from TeX to
<Package>GAPDoc</Package>'s XML was done by David Joyner in 2004.
<P/>
Please send bug reports, suggestions and other comments about
<Package>GUAVA</Package> to
<Email>support@gap-system.org</Email>. Currently known bugs and
suggested <Package>GUAVA</Package> projects are listed in the Issues
section of the <Package>GUAVA</Package> GitHub page:
<URL>https://github.com/gap-packages/guava/issues</URL>.
Older releases and further history can be found on the
<Package>GUAVA</Package> web page
<URL>https://gap-packages.github.io/guava/</URL>.
<P/>
<E>Contributors</E>: Other than the authors listed on the title page,
the following people have contributed code to the <Package>GUAVA</Package>
project: Alexander Hulpke, Steve Linton, Frank Lübeck, Aron Foster,
Wayne Irons, Clifton (Clipper) Lennon, Jason McGowan, Shuhong Gao,
Greg Gamble and Jeffrey S. Leon.
<P/>
For documentation on Leon's programs,
see the <F>src/leon/doc</F> subdirectory of <Package>GUAVA</Package>.
</Acknowledgements>
</TitlePage> <!-- end of title page -->
<TableOfContents/> <!-- OPTIONAL -->
<!-- The document -->
<Body> <!-- REQUIRED -->
<Chapter><Heading>Introduction</Heading>
<Section>
<Heading>Introduction to the <Package>GUAVA</Package> package</Heading>
This is the manual of the GAP package <Package>GUAVA</Package>.
<Package>GUAVA</Package> contains many functions that allow one
to perform computations relevant to the theory of error-correcting codes.
This version of <Package>GUAVA</Package>
requires GAP 4.4.5 or later. The current version of <Package>GUAVA</Package> (3.20) was updated to work with GAP 4.14.0.
<P/>
The functions in <Package>GUAVA</Package> can be divided into three subcategories:
<List>
<Item>
Construction of codes:
<Package>GUAVA</Package> can construct unrestricted, linear and cyclic
codes. Information about the code, such as operations applicable
to the code, is stored in a record-like
data structure called a GAP object.
</Item>
<Item>
Manipulations of codes:
Manipulations transform one code into another, or construct a new code
from two codes. The new code can profit from the data in the record of
the old code(s), so in these cases calculation time often decreases.
</Item>
<Item>
Computations of information about codes:
<Package>GUAVA</Package> can calculate important parameters
of codes quickly. The results are stored in the codes'
object components.
</Item>
</List>
<P/>
Except for the automorphism group and isomorphism
testing functions, which make use of J.S. Leon's
programs (see <Cite Key="Leon91"/> and the documentation
in the 'src/leon' subdirectory of the 'guava'
directory for some details), and
<Ref Func="MinimumWeight" Style="Number"/> function,
<Package>GUAVA</Package> is written in the GAP language, and runs on any system supporting GAP4.4 and above.
Several algorithms that need the speed were integrated
in the GAP kernel.
<P/>
Good general references for error-correcting codes and the
technical terms in this manual are MacWilliams and Sloane
<Cite Key="MS83"/>
and also Huffman and Pless <Cite Key="HP03"/>.
The most recent version of GAP (4.8) comes complete with
all of the packages -- including <Package>GUAVA</Package>.
Thus the following instructions are not usually applicable
but may be needed in certain circumstances.
<P/>
To install <Package>GUAVA</Package>
unpack the archive file
in a directory in the `pkg' hierarchy of your version of GAP 4.
<P/>
After unpacking <Package>GUAVA</Package>
the GAP-only part of <Package>GUAVA</Package> is installed.
The parts of <Package>GUAVA</Package>
depending on J. Leon's backtrack programs package
(for computing automorphism groups) are only available in a UNIX-like
environment, where you should proceed as follows:
Go to the newly created `guava' directory and call
<C>`./configure /gappath'
where <C>/gappath</C> is the path to the GAP
home directory. So for example, if
you install the package in the main `pkg' directory call
<Verb>
./configure ../..
</Verb>
This will fetch the architecture type for which GAP has been compiled
last and create a `Makefile'. Now call
<Verb>
make
</Verb>
to compile the binaries and install them in the appropriate place.
For a Windows machine with CYGWIN installed -
see <URL>https://www.cygwin.com/</URL> - instructions for
compiling Leon's binaries are likely to be similar to those above.
<P/>
If it is not already installed, you should also install the GAP
package <Package>SONATA</Package>. You can download
this from the GAP website and unpack it in the `pkg'
subdirectory.
<P/>
This completes the installation of <Package>GUAVA</Package>
for a single architecture. If
you use this installation of <Package>GUAVA</Package>
on different hardware platforms you
will have to compile the binaries for each platform separately.
If <Package>GUAVA</Package> isn't already in memory, it is
loaded and the author information is displayed.
If you are a frequent user of <Package>GUAVA</Package>,
you might consider adding <Package>GUAVA</Package> to the "PackagesToLoad" preference in your gap initialization file.
(Usually <F>gap.ini</F> which should be located in your
home directory.) Type <F>GAPInfo.UserGapRoot;</F> at the GAP prompt to
find the location of your initialization file. If none exists, the command
<F>WriteGapIniFile();</F> will create a default <F>gap.ini</F> file which you
can then modify.
</Section>
</Chapter>
<Chapter><Heading>A First Tutorial in <Package>GUAVA</Package></Heading>
<Label Name="A First Tutorial in GUAVA"/>
An error-correcting code is essentially just a subset of the set
of all possible messages of a given length over some finite "alphabet."
<P/>
In algebraic coding theory, the "alphabet" is usually some finite field (very often GF(2)) and frequently the error-correcting code is chosen to be a vector subspace of the space of all row vectors of some fixed length <M>n</M>.
Such codes are known as <E>Linear Codes</E>, but, however a code is defined the
point is to have a collection of "codewords" that are said to be "in the code"
and any other word (row vectors that are <E>not</E> "in the code") will be
assumed to be a codeword that has been mangled by the addition of noise.
<P/>
When a message is received that is not a codeword, we ask ourselves the question "Which codeword is closest to this message I've received?" In other words we make the presumption that the received message is actually a codeword that has been changed in a relatively small number of positions -- and <E>we put them back the way they were supposed to be!</E>
<P/>
That process is called "decoding." Developing codes that have efficient decoding algorithms is one of the central problems of algebraic coding theory.
<Section>
<Heading>Working with codewords</Heading>
<P/>
So let's play around a bit.
<P/>
Start <Package>GAP</Package> in a terminal window, then issue the command
<P/>
<Package>GUAVA</Package> can construct codewords in a variety of ways. One
of the most typical cases is for a codeword to consist of binary digits.
In that case we say that "the code is over GF(2)" and codewords can be constructed as follows:
<P/>
The previous excerpt from a <Package>GAP</Package> session shows that
codewords can be constructed from quoted strings or from vectors whose
entries lie in a finite field. We also see that codewords can be added
together and that there is a function called <F>Weight</F> which (if it
isn't obvious) tells us how many entries in a codeword are non-zero.
<P/>
The <E>Hamming distance</E> is used extensively in coding theory. It
tells us in how many positions two codewords differ. In
<Package>GUAVA</Package> the Hamming distance is implemented by a function
called <F>DistanceCodeword</F>.
<P/>
Note that the Hamming distance between <C>c1</C> and <C>c2</C> happens to
give the same value as the weight of their sum. This is no coincidence
and has to do with the curious fact that in GF(2) adding and subtracting
are the same thing.
<P/>
A codeword can also be constructed using a polynomial. Indeed, the internal
representation of a codeword requires either a polynomial or a vector. There
are <Package>GUAVA</Package> functions that allow one to switch back and
forth between the two representations.
<Section>
<Heading>Calculations with codes</Heading>
A code is fundamentally just a collection of codewords. Sometimes a
code is merely a <E>set</E> of codewords. Other times a code will be
the vector space generated by some small set of codewords.
<P/>
First let's build a code that is merely a set:
<P/>
In this example we first wrote out a list of strings, then
converted them into codewords over GF(2). The call to <F>ElementsCode</F>
constructs a code from a list of elements. It is possible that the set
of codewords we used actually is a vector space, but the call to
<F>IsLinearCode</F> says no. Finally the last function tells us that
there are 6 codewords of weight 3, and one each of weights 0 and 6 in
this code.
<P/>
A very useful feature of <Package>GUAVA</Package> is the ability
to construct random codes:
<Log>
gap> C:= RandomLinearCode(12,5,GF(2));
a [12,5,?] randomly generated code over GF(2)
</Log>
<P/>
An error-correcting code's properties are fairly well captured
by three numbers which traditionally are referred to using the
letters <M>n</M>, <M>k</M> and <M>d</M>. We ask for a random code
by specifying <M>n</M> (the wordlength), and <M>k</M> (the code's
dimension) as well as the field which serves as the alphabet for
the code.
<P/>
One of the most salient features of a code (a feature that determines
how good it will be at correcting errors) is its minimum weight, <M>d</M>.
This
is the smallest weight of any nonzero word in the code. If we
wish to correct <M>m</M> errors we will need to have a minimum weight
of at least <M>2m+1</M>.
<Log>
gap> MinimumWeight(C);
3
</Log>
<P/>
This particular code would be capable of correcting single bit errors.
<P/>
Finally, one might be interested in the entire distribution of the weights
of the words in a code. The weight distribution is a vector that tells us
how many words there are in a code with each possible weight between <M>0</M>
and <M>n</M>.
Let <M>GF(q)</M> denote a finite field with <M>q</M> (a prime power)
elements. A <E>code</E> is a subset <M>C</M> of some
finite-dimensional vector space <M>V</M> over <M>GF(q)</M>. The
<E>length</E> of <M>C</M> is the dimension of <M>V</M>.
Usually, <M>V=GF(q)^n</M> and the length is the number of
coordinate entries. When <M>C</M> is itself a vector space
over <M>GF(q)</M> then it is called a <E>linear code</E>
<Index>linear code</Index> and
the <E>dimension</E> of <M>C</M>
is its dimension as a vector space over <M>GF(q)</M>.
<P/>
In <Package>GUAVA</Package>, a `codeword' is a GAP record,
with one of its components being an element in <M>V</M>.
Likewise, a `code' is a GAP record,
with one of its components being a subset (or subspace with given
basis, if <M>C</M> is linear) of <M>V</M>.
Mathematically, a `codeword' is an element of a code C,
but in <Package>GUAVA</Package> the <C>Codeword</C>
and <C>VectorCodeword</C> commands have implementations which do not check if
the codeword belongs to <M>C</M> (i.e., are independent
of the code itself). They exist primarily to make it
easier for the user to construct the associated GAP record.
Using these commands, one can enter into GAP
both a codeword <M>c</M> (belonging to <M>C</M>)
and a received word <M>r</M> (not belonging to <M>C</M>)
using the same command. The user can input codewords in different
formats (as strings, vectors, and polynomials),
and output information is formatted in a readable way.
<P/>
A codeword <M>c</M> in a linear code <M>C</M> arises in practice by
an initial encoding of a 'block' message
<M>m</M>, adding enough redundancy to recover <M>m</M> after
<M>c</M> is transmitted via a 'noisy' communication medium.
In <Package>GUAVA</Package>, for linear codes,
the map <M>m\longmapsto c</M>
is computed using the command <C>c:=m*C</C> and
recovering <M>m</M> from <M>c</M> is obtained by the
command <C>InformationWord(C,c)</C>. These commands are explained
more below.
<P/>
Many operations are available on codewords themselves,
although codewords also work together with codes
(see chapter <Ref Label="Codes" Style="Number"/> on Codes).
<P/>
The first section describes how codewords are constructed (see
<Ref Func="Codeword" Style="Number"/> and
<Ref Func="IsCodeword" Style="Number"/>).
Sections <Ref Label="Comparisons of Codewords" Style="Number"/> and
<Ref Label="Arithmetic Operations for Codewords" Style="Number"/>
describe the arithmetic operations applicable to codewords.
Section
<Ref Label="convert Codewords to Vectors or Polynomials" Style="Number"/>
describe functions that convert codewords back to vectors or polynomials
(see
<Ref Func="VectorCodeword" Style="Number"/> and
<Ref Func="PolyCodeword" Style="Number"/>).
Section <Ref Label="Functions that Change the Display Form of a Codeword"
Style="Number"/> describe
functions that change the way a codeword is displayed (see
<Ref Func="TreatAsVector" Style="Number"/> and
<Ref Func="TreatAsPoly" Style="Number"/>).
Finally, Section <Ref Label="Other Codeword Functions" Style="Number"/>
describes a function to
generate a null word (see <Ref Func="NullWord" Style="Number"/>)
and some functions for extracting
properties of codewords
(see <Ref Func="DistanceCodeword" Style="Number"/>,
<Ref Func="Support" Style="Number"/>
and <Ref Func="WeightCodeword" Style="Number"/>).
<Section>
<Heading>Construction of Codewords</Heading>
<Label Name="Construction of Codewords"/>
<Description>
<C>Codeword</C> returns a codeword or a list of codewords constructed from
<Arg>obj</Arg>.
The object <Arg>obj</Arg> can be a vector, a string, a polynomial or a
codeword. It may also be a list of those (even a mixed list).
<P/>
If a number <Arg>n</Arg> is specified, all constructed codewords
have length <Arg>n</Arg>.
This is the only way to make sure that all elements of
<Arg>obj</Arg> are converted to codewords of the same length.
Elements of <Arg>obj</Arg> that are
longer than <Arg>n</Arg> are reduced in length by cutting of the last
positions. Elements of <Arg>obj</Arg> that are
shorter than <Arg>n</Arg> are lengthened by
adding zeros at the end. If no <Arg>n</Arg> is specified, each constructed
codeword is handled individually.
<P/>
If a Galois field <Arg>F</Arg> is specified, all
codewords are constructed over
this field. This is the only way to make sure that all elements of
<Arg>obj</Arg>
are converted to the same field <Arg>F</Arg>
(otherwise they are converted one by
one). Note that all elements of <Arg>obj</Arg> must have elements over
<Arg>F</Arg> or over `Integers'.
Converting from one Galois field to another is not
allowed. If no <Arg>F</Arg> is specified, vectors or
strings with integer elements
will be converted to the smallest Galois field possible.
<P/>
Note that a significant speed increase is achieved
if <Arg>F</Arg> is specified,
even when all elements of <Arg>obj</Arg> already have
elements over <Arg>F</Arg>.
<P/>
Every vector in <Arg>obj</Arg> can be a finite field vector over
<Arg>F</Arg> or a vector over `Integers'. In the last case, it is converted to
<Arg>F</Arg> or, if omitted, to the smallest Galois field possible.
<P/>
Every string in <Arg>obj</Arg> must be a string of numbers,
without spaces, commas
or any other characters. These numbers must be from 0 to 9. The string is
converted to a codeword over <Arg>F</Arg> or,
if <Arg>F</Arg> is omitted, over the smallest
Galois field possible. Note that since all numbers in the string are
interpreted as one-digit numbers, Galois fields of size larger than 10
are not properly represented when using strings. In fact, no
finite field of size larger than 11 arises in this fashion at all.
<P/>
Every polynomial in <Arg>obj</Arg> is converted to a codeword of
length <Arg>n</Arg> or, if
omitted, of a length dictated by the degree of the polynomial.
If <Arg>F</Arg> is specified, a polynomial in
<Arg>obj</Arg> must be over <Arg>F</Arg>.
<P/>
Every element of <Arg>obj</Arg> that is already a codeword is
changed to a codeword of length <Arg>n</Arg>.
If no <Arg>n</Arg> was specified, the
codeword doesn't change. If F is specified,
the codeword must have base field <Arg>F</Arg>.
<P/>
This command can also be called using the syntax
<C>Codeword(obj,C)</C>.
In this format, the elements of <Arg>obj</Arg>
are converted to elements of the
same ambient vector space as the elements of a code <Arg>C</Arg>.
The command <C>Codeword(c,C)</C>
is the same as calling <C>Codeword(c,n,F)</C>, where
<Arg>n</Arg> is the word length of <Arg>C</Arg>
and the <Arg>F</Arg> is the ground field of <Arg>C</Arg>.
</Description>
</ManSection>
<Description>
<C>CodewordNr</C> returns a list of codewords of <Arg>C</Arg>.
<Arg>list</Arg> may be a list of
integers or a single integer. For each integer of
<Arg>list</Arg>, the
corresponding codeword of <Arg>C</Arg> is returned.
The correspondence of a number
<M>i</M> with a codeword is determined as follows: if a list of elements of
<Arg>C</Arg> is available, the <M>i^{th}</M> element is taken. Otherwise, it is
calculated by multiplication of the <M>i^{th}</M> information vector by the
generator matrix or generator polynomial, where the information vectors
are ordered lexicographically. In particular, the returned
codeword(s) could be a vector or a polynomial.
So <C>CodewordNr(C, i)</C> is equal to
<C>AsSSortedList(C)[i]</C>, described in the next chapter.
The latter function first calculates the set of all
the elements of <M>C</M> and then
returns the <M>i^{th}</M> element of that set, whereas the
former only calculates the <M>i^{th}</M> codeword.
</Description>
</ManSection>
<Example>
gap> B := BinaryGolayCode();
a cyclic [23,12,7]3 binary Golay code over GF(2)
gap> c := CodewordNr(B, 4);
x^22 + x^20 + x^17 + x^14 + x^13 + x^12 + x^11 + x^10
gap> R := ReedSolomonCode(2,2);
a cyclic [2,1,2]1 Reed-Solomon code over GF(3)
gap> AsSSortedList(R);
[ [ 0 0 ], [ 1 1 ], [ 2 2 ] ]
gap> CodewordNr(R, [1,3]);
[ [ 0 0 ], [ 2 2 ] ]
</Example> <!-- B := BinaryGolayCode(); c := CodewordNr(B, 4); R := ReedSolomonCode(2,2); AsSSortedList(R); CodewordNr(R, [1,3]);
-->
<Description>
<C>IsCodeword</C> returns `true' if obj,
which can be an object of arbitrary type, is of the codeword type and `false' otherwise. The function will
signal an error if <Arg>obj</Arg> is an unbound variable.
</Description>
</ManSection>
<Description>
The equality operator <C>c1 = c2</C>
evaluates to `true' if the codewords
<A>c1</A>
and <A>c2</A> are 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.
<P/>
Comparing codewords with objects of other types is not recommended,
although it is possible. If <A>c2</A> is the codeword, the other object
<A>c1</A> 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 <A>c1</A> is the codeword, then problems may arise if
<A>c2</A> is a polynomial. In that case, the comparison always
yields a `false', because the polynomial comparison is called.
<P/>
The equality operator is also denoted <C>EQ</C>, and
<C>EQ(c1,c2)</C> is the same as <C>c1 = c2</C>.
There is also an inequality operator, &tlt; &tgt;,
or <C>not EQ</C>.
<Description>
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.
<Index>codewords, addition</Index>
<P/>
The operator <C>+</C> evaluates to the sum of the codewords <A>c1</A>
and <A>c2</A>.
</Description>
</ManSection>
<Example><![CDATA[
gap> C:=RandomLinearCode(10,5,GF(3));
a [10,5,?] randomly generated code over GF(3)
gap> c:=Random(C);
[ 1 0 2 2 2 2 1 0 2 0 ]
gap> Codeword(c+"2000000000");
[ 0 0 2 2 2 2 1 0 2 0 ]
gap> Codeword(c+"1000000000");
Error, <x> and <y> have different characteristic
]]></Example> <!-- C:=RandomLinearCode(10,5,GF(3)); c:=Random(C); Codeword(c+"2000000000"); Codeword(c+"1000000000");
-->
The last command returns a GAP ERROR since
the `codeword' which GUAVA
associates to "1000000000" belongs to <M>GF(2)</M>
and not <M>GF(3)</M>.
<Description>
Similar to addition:
the operator <C>-</C> evaluates to the difference of the codewords
<A>c1</A> and <A>c2</A>.
<Index>codewords, subtraction</Index>
</Description>
</ManSection>
<ManSection>
<Meth Name="\+" Label="for codeword and code" Arg="v C"/>
<Description>
The operator <C>v+C</C> evaluates to the coset code of code <A>C</A>
after adding a `codeword' v to all codewords in C.
Note that if <M>c \in C</M> then mathematically
<M>c+C=C</M> but <Package>GUAVA</Package> only
sees them equal as <E>sets</E>.
See <Ref Func="CosetCode" Style="Number"/>.
<P/>
Note that the command <C>C+v</C> returns the same output
as the command <C>v+C</C>.
<P/>
<Index>codewords, cosets</Index>
</Description>
</ManSection>
<Index>coset</Index>
<Example><![CDATA[
gap> C:=RandomLinearCode(10,5);
a [10,5,?] randomly generated code over GF(2)
gap> c:=Random(C);
[ 0 0 0 0 0 0 0 0 0 0 ]
gap> c+C;
<add. coset of a [10,5,?] randomly generated code over GF(2)>
gap> c+C=C;
true
gap> IsLinearCode(c+C);
false
gap> v:=Codeword("100000000");
[ 1 0 0 0 0 0 0 0 0 ]
gap> v+C;
<add. coset of a [10,5,?] randomly generated code over GF(2)>
gap> C=v+C;
false
gap> C := GeneratorMatCode( [ [1, 0,0,0], [0, 1,0,0] ], GF(2) );
a linear [4,2,1]1..2 code defined by generator matrix over GF(2)
gap> Elements(C);
[ [ 0 0 0 0 ], [ 0 1 0 0 ], [ 1 0 0 0 ], [ 1 1 0 0 ] ]
gap> v:=Codeword("0011");
[ 0 0 1 1 ]
gap> C+v;
<add. coset of a linear [4,2,4]1 code defined by generator matrix over GF(2)>
gap> Elements(C+v);
[ [ 0 0 1 1 ], [ 0 1 1 1 ], [ 1 0 1 1 ], [ 1 1 1 1 ] ]
]]></Example> <!-- C:=RandomLinearCode(10,5); c:=Random(C); c+C; c+C=C; IsLinearCode(c+C); v:=Codeword("100000000"); v+C; C=v+C; C := GeneratorMatCode( [ [1, 0,0,0], [0, 1,0,0] ], GF(2) ); Elements(C); v:=Codeword("0011"); C+v; Elements(C+v);
-->
In general, the operations just described can also be performed on
codewords expressed as 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 (<C>FiniteFieldPolynomialOps</C>) are called, instead of
the codeword operations (<C>CodewordOps</C>).
<P/>
Some other code-oriented operations with codewords are described in
<Ref Subsect="Operations for Codes" Style="Number"/>.
</Section>
<Section>
<Heading>
Functions that Convert Codewords to Vectors or Polynomials
</Heading>
<Label Name="convert Codewords to Vectors or Polynomials"/>
<Description>
Here <A>obj</A> can be a code word or a list of code words. This function
returns the corresponding vectors over a finite field.
</Description>
</ManSection>
<Description>
<C>PolyCodeword</C> returns a polynomial or a list
of polynomials over a Galois field, converted from <A>obj</A>.
The object <A>obj</A> can be a codeword, or a list of codewords.
</Description>
</ManSection>
<Example>
gap> a := Codeword("011011");;
gap> PolyCodeword(a);
x_1^5+x_1^4+x_1^2+x_1
</Example> <!-- a := Codeword("011011");; PolyCodeword(a);
-->
</Section>
<Section>
<Heading>
Functions that Change the Display Form of a Codeword
</Heading>
<Label Name="Functions that Change the Display Form of a Codeword"/>
<Description>
<C>TreatAsVector</C> adapts the codewords in
<A>obj</A> to make sure they are printed as vectors.
<A>obj</A> may be a codeword or a list of codewords.
Elements of <A>obj</A> that are not codewords are ignored. After
this function is called, the codewords will be treated as vectors. The
vector representation is obtained by using the coefficient list of the
polynomial.
<P/>
Note that this <E>only</E> changes the way a codeword is <E>printed</E>.
<C>TreatAsVector</C> returns nothing, it is called only for its side effect.
The function <C>VectorCodeword</C> converts codewords to vectors (see
<Ref Func="VectorCodeword" Style="Number"/>).
</Description>
</ManSection>
<Description>
<C>TreatAsPoly</C> adapts the codewords in <A>obj</A>
to make sure they are printed
as polynomials. <A>obj</A> may be a codeword or a list of codewords. Elements
of <A>obj</A> that are not codewords are ignored. After this function is
called, the codewords will be treated as polynomials. The finite field
vector that defines the codeword is used as a coefficient list of the
polynomial representation, where the first element of the vector is the
coefficient of degree zero, the second element is the coefficient of
degree one, etc, until the last element, which is the coefficient of
highest degree.
<P/>
Note that this <E>only</E> changes the way a codeword is
<E>printed</E>. <C>TreatAsPoly</C>
returns nothing, it is called only for its side effect. The function
<C>PolyCodeword</C> converts codewords to polynomials
(see <Ref Func="PolyCodeword" Style="Number"/>).
</Description>
</ManSection>
<Section>
<Heading>
Other Codeword Functions
</Heading>
<Label Name="Other Codeword Functions"/>
<ManSection>
<Func Name="NullWord" Arg="n F"/>
<Description>
Other uses: <C>NullWord( n )</C> (default <M>F=GF(2)</M>)
and <C>NullWord( C )</C>.
<C>NullWord</C> returns a codeword of length <A>n</A> over the
field <A>F</A> of only zeros. The integer
<A>n</A> must be greater then zero. If
only a code <Arg>C</Arg> is specified, <C>NullWord</C>
will return a null word with both the
word length and the Galois field of <Arg>C</Arg>.
</Description>
</ManSection>
<Description>
<C>DistanceCodeword</C> returns the Hamming distance from
<A>c1</A> to <A>c2</A>. Both
variables must be codewords with equal word length over the same Galois
field. The Hamming distance between two words is the number of places in
which they differ. As a result, <C>DistanceCodeword</C>
always returns an integer between zero and the word length of the codewords.
</Description>
</ManSection>
<Description>
<C>Support</C> returns a set of integers indicating the positions of
the non-zero entries in a codeword <A>c</A>.
</Description>
</ManSection>
The support of a list with codewords can be calculated by taking the
union of the individual supports. The weight of the support is the length
of the set.
<Example>
gap> L := Codeword(["000000", "101010", "222000"], GF(3));;
gap> S := Union(List(L, i -> Support(i)));
[ 1, 2, 3, 5 ]
gap> Length(S);
4
</Example> <!-- L := Codeword(["000000", "101010", "222000"], GF(3));; S := Union(List(L, i -> Support(i))); Length(S);
-->
<Description>
<C>WeightCodeword</C> returns the weight of a codeword
<M>c</M>, the number of non-zero entries in <A>c</A>.
As a result, <C>WeightCodeword</C> always returns an
integer between zero and the word length of the codeword.
</Description>
</ManSection>
<Example>
gap> WeightCodeword(Codeword("22222"));
5
gap> WeightCodeword(NullWord(3));
0
gap> C := HammingCode(3);
a linear [7,4,3]1 Hamming (3,2) code over GF(2)
gap> Minimum(List(AsSSortedList(C){[2..Size(C)]}, WeightCodeword ) );
3
</Example> <!-- WeightCodeword(Codeword("22222")); WeightCodeword(NullWord(3)); C := HammingCode(3); Minimum(List(AsSSortedList(C){[2..Size(C)]}, WeightCodeword ) );
-->
A <E>code</E> is a set of codewords (recall a
<Index>code</Index>
<Index>code, elements of</Index>
codeword in <Package>GUAVA</Package> is simply
a sequence of elements of a finite field
<M>GF(q)</M>, where <M>q</M> is a prime power).
We call these the <E>elements</E> of the code.
Depending on the type of code, a codeword can be interpreted as
a vector or as a polynomial.
This is explained in more detail in Chapter
<Ref Label="Codewords" Style="Number"/>.
<P/>
In <Package>GUAVA</Package>,
codes can be a set specified by its elements (this will be called
an <E>unrestricted code</E>),
<Index>code, unrestricted</Index>
by a generator matrix listing a set of basis elements
(for a linear code) or by a
generator polynomial (for a cyclic code).
<P/>
Any code can be defined by its elements. If you like, you can give the
code a name.
<Example>
gap> C := ElementsCode(["1100", "1010", "0001"], "example code", GF(2) );
a (4,3,1..4)2..4 example code over GF(2)
</Example>
An <M>(n,M,d)</M> code is a code with word <E>length</E>
<M>n</M>, <E>size</E> <M>M</M> and
<E>minimum distance</E> <M>d</M>.
<Index>
code, <M>(n,M,d)</M>
</Index>
<Index>
minimum distance
</Index>
<Index>
length
</Index>
<Index>
size
</Index>
If the minimum distance has not yet been
calculated, the lower bound and upper bound are printed
(except in the case where the code is a random linear codes,
where these are not printed for efficiency reasons). So
<Verb>
a (4,3,1..4)2..4 code over GF(2)
</Verb>
means a binary unrestricted code of length <M>4</M>, with <M>3</M>
elements and the minimum distance is greater than or equal to
<M>1</M> and less than or equal to <M>4</M>
and the covering radius is greater than or equal to <M>2</M> and less
than or equal to <M>4</M>.
<Example>
gap> C := ElementsCode(["1100", "1010", "0001"], "example code", GF(2) );
a (4,3,1..4)2..4 example code over GF(2)
gap> MinimumDistance(C);
2
gap> C;
a (4,3,2)2..4 example code over GF(2)
</Example> <!-- C := ElementsCode(["1100", "1010", "0001"], "example code", GF(2) ); MinimumDistance(C); C;
-->
If the set of elements is a linear subspace of <M>GF(q)^n</M>,
the code is called <E>linear</E>. If a code is linear, it can be
defined by its <E>generator matrix</E> or <E>parity check matrix</E>.
<Index>code, linear</Index>
<Index>parity check matrix</Index>
By definition,
the rows of the generator matrix is a basis for
the code (as a vector space over <M>GF(q)</M>).
By definition,
the rows of the parity check matrix is a basis for the
dual space of the code,
<Display>
C^* = \{ v \in GF(q)^n\ |\ v\cdot c = 0,\ for \ all\ c \in C \}.
</Display>
<Example>
gap> G := GeneratorMatCode([[1,0,1],[0,1,2]], "demo code", GF(3) );
a linear [3,2,1..2]1 demo code over GF(3)
</Example>
So a linear <M>[n, k, d]r</M> code
<Index>
code, <M>[n, k, d]r</M>
</Index>
is a code with word <E>length</E> <M>n</M>,
<E>dimension</E> <M>k</M>, <E>minimum distance</E>
<M>d</M> and <E>covering radius</E> <M>r</M>.
<P/>
If the code is linear and all cyclic shifts of its codewords
(regarded as <M>n</M>-tuples) are again
codewords, the code is called <E>cyclic</E>.
<Index>code, cyclic</Index>
All elements of a cyclic code are multiples
of the monic polynomial modulo a polynomial <M>x^n -1</M>,
where <M>n</M> is the word length of the code.
Such a polynomial is called a <E>generator polynomial</E>
<Index>generator polynomial</Index>
The generator polynomial must divide <M>x^n-1</M> and its
quotient is called a <E>check polynomial</E>.
<Index>check polynomial</Index>
Multiplying a codeword in a cyclic code by the check
polynomial yields zero (modulo the polynomial <M>x^n -1</M>).
In <Package>GUAVA</Package>, a
cyclic code can be defined by either its generator polynomial or
check polynomial.
<Example>
gap> G := GeneratorPolCode(Indeterminate(GF(2))+Z(2)^0, 7, GF(2) );
a cyclic [7,6,1..2]1 code defined by generator polynomial over GF(2)
</Example>
It is possible that <Package>GUAVA</Package>
does not know that an unrestricted code is in fact
linear. This situation occurs for example when a code is generated from a
list of elements with the function <C>ElementsCode</C>
(see <Ref Func="ElementsCode" Style="Number"/>).
By calling the function <C>IsLinearCode</C> (see
<Ref Func="IsLinearCode" Style="Number"/>), <Package>GUAVA</Package>
tests if the code can be represented by a generator matrix.
If so, the code record and the operations are converted accordingly.
<Example>
gap> L := Z(2)*[ [0,0,0], [1,0,0], [0,1,1], [1,1,1] ];;
gap> C := ElementsCode( L, GF(2) );
a (3,4,1..3)1 user defined unrestricted code over GF(2)
# so far, GUAVA does not know what kind of code this is
gap> IsLinearCode( C );
true
gap> C;
a linear [3,2,1]1 user defined unrestricted code over GF(2)
</Example> <!-- L := Z(2)*[ [0,0,0], [1,0,0], [0,1,1], [1,1,1] ];; C := ElementsCode( L, GF(2) ); IsLinearCode( C ); C;
-->
Of course the same holds for unrestricted codes that in fact are cyclic,
or codes, defined by a generator matrix, that actually are cyclic.
<P/>
Codes are printed simply by giving a small description of their
parameters, the word length, size or dimension and perhaps
the minimum distance,
followed by a short description and the base field of the code. The
function <C>Display</C> gives a more detailed description, showing the
construction history of the code.
<P/>
<Package>GUAVA</Package> doesn't place much emphasis on the
actual encoding and decoding
processes; some algorithms have been included though. Encoding works
simply by multiplying an information vector with a code, decoding is done
by the functions <C>Decode</C> or <C>Decodeword</C>.
For more information about encoding and
decoding, see sections
<Ref Label="Operations for Codes" Style="Number"/> and
<Ref Label="Decode" Style="Number"/>.
<Example>
gap> R := ReedMullerCode( 1, 3 );
a linear [8,4,4]2 Reed-Muller (1,3) code over GF(2)
gap> w := [ 1, 0, 1, 1 ] * R;
[ 1 0 0 1 1 0 0 1 ]
gap> Decode( R, w );
[ 1 0 1 1 ]
gap> Decode( R, w + "10000000" ); # One error at the first position. Corrected by Guava.
[ 1 0 1 1 ]
</Example> <!-- R := ReedMullerCode( 1, 3 ); w := [ 1, 0, 1, 1 ] * R; Decode( R, w ); Decode( R, w + "10000000" );
-->
Sections <Ref Label="Comparisons of Codes" Style="Number"/> and
<Ref Label="Operations for Codes" Style="Number"/> describe the
operations that are available for codes.
Section <Ref Label="Boolean Functions for Codes" Style="Number"/> describe
the functions that tests
whether an object is a code and what kind of code it is (see <C>IsCode</C>,
<Ref Func="IsLinearCode" Style="Number"/> and <C>IsCyclicCode</C>)
and various other boolean functions for codes.
Section <Ref Label="Equivalence and Isomorphism of Codes" Style="Number"/>
describe functions about equivalence and isomorphism of
codes (see <Ref Func="IsEquivalent" Style="Number"/>,
<Ref Func="CodeIsomorphism" Style="Number"/> and
<Ref Func="AutomorphismGroup" Style="Number"/>).
Section <Ref Label="Domain Functions for Codes" Style="Number"/>
describes functions that work on
<E>domains</E> (see Chapter "Domains and their Elements" in the GAP
Reference Manual).
Section <Ref Label="Printing and Displaying Codes" Style="Number"/>
describes functions for printing and displaying codes.
Section
<Ref Label="Generating (Check) Matrices and Polynomials" Style="Number"/>
describes functions that return the matrices and polynomials
that define a code (see
<Ref Func="GeneratorMat" Style="Number"/>,
<Ref Func="CheckMat" Style="Number"/>,
<Ref Func="GeneratorPol" Style="Number"/>,
<Ref Func="CheckPol" Style="Number"/>,
<Ref Func="RootsOfCode" Style="Number"/>).
Section <Ref Label="Parameters of Codes" Style="Number"/>
describes functions that return the basic
parameters of codes (see <Ref Func="WordLength" Style="Number"/>,
<Ref Func="Redundancy" Style="Number"/> and
<Ref Func="MinimumDistance" Style="Number"/>).
Section <Ref Label="Distributions" Style="Number"/>
describes functions that return distance and
weight distributions (see
<Ref Func="WeightDistribution" Style="Number"/>,
<Ref Func="InnerDistribution" Style="Number"/>,
<Ref Func="OuterDistribution" Style="Number"/> and
<Ref Func="DistancesDistribution" Style="Number"/>).
Section <Ref Label="Decoding Functions" Style="Number"/>
describes functions that are related to
decoding (see <Ref Func="Decode" Style="Number"/>,
<Ref Func="Decodeword" Style="Number"/>,
<Ref Func="Syndrome" Style="Number"/>,
<Ref Func="SyndromeTable" Style="Number"/> and
<Ref Func="StandardArray" Style="Number"/>).
In Chapters <Ref Label="Generating Codes" Style="Number"/> and
<Ref Label="Manipulating Codes" Style="Number"/> which follow,
we describe functions that generate and manipulate codes.
<Section>
<Heading>Comparisons of Codes</Heading>
<Label Name="Comparisons of Codes"/>
<Description>
The equality operator <C>C1 = C2</C>
evaluates to `true' if the codes C1
and <A>C2</A> are equal, and to `false' otherwise.
<P/>
The equality operator is also denoted <C>EQ</C>, and
<C>Eq(C1,C2)</C> is the same as <C>C1 = C2</C>.
There is also an inequality operator, &tlt; &tgt;,
or <C>not EQ</C>.
<P/>
Note that codes are equal if and only if their set of elements are equal. Codes
can also be compared with objects of other types. Of course they are
never equal.
</Description>
</ManSection>
<Index>not =</Index>
<Index>&tlt; &tgt;</Index>
<Example>
gap> M := [ [0, 0], [1, 0], [0, 1], [1, 1] ];;
gap> C1 := ElementsCode( M, GF(2) );
a (2,4,1..2)0 user defined unrestricted code over GF(2)
gap> M = C1;
false
gap> C2 := GeneratorMatCode( [ [1, 0], [0, 1] ], GF(2) );
a linear [2,2,1]0 code defined by generator matrix over GF(2)
gap> C1 = C2;
true
gap> ReedMullerCode( 1, 3 ) = HadamardCode( 8 );
true
gap> WholeSpaceCode( 5, GF(4) ) = WholeSpaceCode( 5, GF(2) );
false
</Example> <!-- M := [ [0, 0], [1, 0], [0, 1], [1, 1] ];; C1 := ElementsCode( M, GF(2) ); M = C1; C2 := GeneratorMatCode( [ [1, 0], [0, 1] ], GF(2) ); C1 = C2; ReedMullerCode( 1, 3 ) = HadamardCode( 8 ); WholeSpaceCode( 5, GF(4) ) = WholeSpaceCode( 5, GF(2) );
-->
Another way of comparing codes is <C>IsEquivalent</C>, which checks if two
codes are equivalent (see <Ref Func="IsEquivalent" Style="Number"/>).
By the way, this called <C>CodeIsomorphism</C>.
For the current version of <Package>GUAVA</Package>,
unless one of the codes is unrestricted,
this calls Leon's C program (which only works for binary linear codes
and only on a unix/linux computer).
</Section>
<Section>
<Heading>
Operations for Codes
</Heading>
<Label Name="Operations for Codes"/>
<Description>
<Index>
codes, addition
</Index>
<Index>
codes, direct sum
</Index>
The operator `+' evaluates to the direct sum of the codes C1 and
<A>C2</A>. See <Ref Func="DirectSumCode" Style="Number"/>.
<P/>
</Description>
</ManSection>
<Example>
gap> C1:=RandomLinearCode(10,5);
a [10,5,?] randomly generated code over GF(2)
gap> C2:=RandomLinearCode(9,4);
a [9,4,?] randomly generated code over GF(2)
gap> C1+C2;
a linear [19,9,1..2]4..9 direct sum code
</Example>
The operator `*' evaluates to the direct product of the codes
<A>C1</A> and <A>C2</A>.
See <Ref Func="DirectProductCode" Style="Number"/>.
</Description>
</ManSection>
<Example>
gap> C1 := GeneratorMatCode( [ [1, 0,0,0], [0, 1,0,0] ], GF(2) );
a linear [4,2,1]1..2 code defined by generator matrix over GF(2)
gap> C2 := GeneratorMatCode( [ [0,0,1, 1], [0,0,0, 1] ], GF(2) );
a linear [4,2,1]1..2 code defined by generator matrix over GF(2)
gap> C1*C2;
a linear [16,4,1]4..12 direct product code
</Example> <!-- C1 := GeneratorMatCode( [ [1, 0,0,0], [0, 1,0,0] ], GF(2) ); C2 := GeneratorMatCode( [ [0,0,1, 1], [0,0,0, 1] ], GF(2) ); C1*C2;
-->
<ManSection>
<Meth Name="\*" Label="for message and code" Arg=" m C"/>
<Description>
<Index>codes, encoding </Index>
<Index>encoder map </Index>
The operator <C>m*C</C> evaluates to the element of
<A>C</A> belonging to information word ('message') <A>m</A>.
Here <A>m</A> may be a vector, polynomial, string or
codeword or a list of those.
This is the way to do encoding in
<Package>GUAVA</Package>. <A>C</A> must be linear,
because in <Package>GUAVA</Package>, encoding by multiplication is only defined for
linear codes. If <A>C</A> is a cyclic code, this multiplication is the same as
multiplying an information polynomial <A>m</A> by the generator
polynomial of <A>C</A>.
If <A>C</A> is a linear code, it is equal to the multiplication
of an information vector <A>m</A> by
a generator matrix of <A>C</A>.
<P/>
To invert this, use the function <C>InformationWord</C> (see
<Ref Func="InformationWord" Style="Number"/>,
which simply calls the function <C>Decode</C>).
</Description>
</ManSection>
<Example>
gap> C := GeneratorMatCode( [ [1, 0,0,0], [0, 1,0,0] ], GF(2) );
a linear [4,2,1]1..2 code defined by generator matrix over GF(2)
gap> m:=Codeword("11");
[ 1 1 ]
gap> m*C;
[ 1 1 0 0 ]
</Example> <!-- C := GeneratorMatCode( [ [1, 0,0,0], [0, 1,0,0] ], GF(2) ); m:=Codeword("11"); m*C;
-->
<ManSection>
<Func Name="InformationWord" Arg=" C c"/>
<Description>
<Index>codes, decoding </Index>
<Index>information bits </Index>
Here <A>C</A> is a linear code and <A>c</A> is
a codeword in it. The command <C>InformationWord</C>
returns the message word (or 'information digits') <M>m</M>
satisfying <C>c=m*C</C>. This command simply calls <C>Decode</C>,
provided <C>c in C</C> is true. Otherwise, it returns an error.
<P/>
To invert this, use the encoding function <C>*</C> (see
<Ref Meth="\*" Label="for message and code" Style="Number"/>).
<Section>
<Heading>
Boolean Functions for Codes
</Heading>
<Label Name="Boolean Functions for Codes"/>
<ManSection>
<Func Name="in" Arg=" c C"/>
<Description>
<Index>code, element test</Index>
The command
<C>c in C</C> evaluates to `true' if C contains the codeword or
list of codewords specified by <A>c</A>.
Of course, <A>c</A> and <A>C</A> must have the
same word lengths and base fields.
</Description>
</ManSection>
<Example>
gap> C:= HammingCode( 2 );; eC:= AsSSortedList( C );
[ [ 0 0 0 ], [ 1 1 1 ] ]
gap> eC[2] in C;
true
gap> [ 0 ] in C;
false
</Example> <!-- C:= HammingCode( 2 );; eC:= AsSSortedList( C ); eC[2] in C; [ 0 ] in C;
-->
<ManSection>
<Func Name="IsSubset" Arg=" C1 C2"/>
<Description>
<Index>code, subcode</Index>
The command <C>IsSubset(C1,C2)</C> returns `true' if C2
is a subcode of <A>C1</A>,
i.e. if <A>C1</A> contains all the elements of <A>C2</A>.
<Description>
<C>IsCode</C> returns `true' if obj, which
can be an object of arbitrary type, is a code and
`false' otherwise. Will cause an error if obj is an
unbound variable.
</Description>
</ManSection>
<Description>
<C>IsLinearCode</C> checks if object <A>obj</A>
(not necessarily a code) is a linear code.
If a code has already been marked as linear or cyclic, the
function automatically returns `true'. Otherwise, the function checks if
a basis <M>G</M> of the elements of <A>obj</A> exists that
generates the elements
of <A>obj</A>. If so, <M>G</M> is recorded as
a generator matrix of <A>obj</A> and the function
returns `true'. If not, the function returns `false'.
</Description>
</ManSection>
<Example>
gap> C := ElementsCode( [ [0,0,0],[1,1,1] ], GF(2) );
a (3,2,1..3)1 user defined unrestricted code over GF(2)
gap> IsLinearCode( C );
true
gap> IsLinearCode( ElementsCode( [ [1,1,1] ], GF(2) ) );
false
gap> IsLinearCode( 1 );
false
</Example> <!-- C := ElementsCode( [ [0,0,0],[1,1,1] ], GF(2) ); IsLinearCode( C ); IsLinearCode( ElementsCode( [ [1,1,1] ], GF(2) ) ); IsLinearCode( 1 );
-->
<Description>
<C>IsCyclicCode</C> checks if the object <A>obj</A> is a cyclic code.
If a code has
already been marked as cyclic, the function automatically returns `true'.
Otherwise, the function checks if a polynomial <M>g</M> exists that generates
the elements of <A>obj</A>. If so, <M>g</M> is recorded as
a generator polynomial of
<A>obj</A> and the function returns `true'. If not, the function
returns `false'.
</Description>
</ManSection>
<Example>
gap> C := ElementsCode( [ [0,0,0], [1,1,1] ], GF(2) );
a (3,2,1..3)1 user defined unrestricted code over GF(2)
gap> # GUAVA does not know the code is cyclic
gap> IsCyclicCode( C ); # this command tells GUAVA to find out
true
gap> IsCyclicCode( HammingCode( 4, GF(2) ) );
false
gap> IsCyclicCode( 1 );
false
</Example> <!-- C := ElementsCode( [ [0,0,0], [1,1,1] ], GF(2) ); IsCyclicCode( C ); IsCyclicCode( HammingCode( 4, GF(2) ) ); IsCyclicCode( 1 );
-->
<ManSection>
<Func Name="IsPerfectCode" Arg=" C "/>
<Description>
<C>IsPerfectCode(C)</C> returns `true' if
<A>C</A> is a perfect code. If <M>C\subset GF(q)^n</M>
then, by definition, this means that for some
positive integer <M>t</M>, the space <M>GF(q)^n</M>
is covered by non-overlapping spheres of
(Hamming) radius <M>t</M> centered at the codewords in <A>C</A>.
For a code with odd minimum distance <M>d = 2t+1</M>,
this is the case when every word of the
vector space of <A>C</A> is at distance at most <M>t</M> from exactly
one element
of <A>C</A>. Codes with even minimum distance are never perfect.
<P/>
In fact, a code that is not "trivially perfect" (the binary repetition
codes of odd length, the codes consisting of one word, and the codes
consisting of the whole vector space), and does not have the parameters
of a Hamming or Golay code, cannot be perfect
(see section 1.12 in <Cite Key="HP03"/>).
</Description>
</ManSection>
<Index>code, perfect</Index>
<Example>
gap> H := HammingCode(2);
a linear [3,1,3]1 Hamming (2,2) code over GF(2)
gap> IsPerfectCode( H );
true
gap> IsPerfectCode( ElementsCode([[1,1,0],[0,0,1]],GF(2)) );
true
gap> IsPerfectCode( ReedSolomonCode( 6, 3 ) );
false
gap> IsPerfectCode( BinaryGolayCode() );
true
</Example> <!-- H := HammingCode(2); IsPerfectCode( H ); IsPerfectCode( ElementsCode([[1,1,0],[0,0,1]],GF(2)) ); IsPerfectCode( ReedSolomonCode( 6, 3 ) ); IsPerfectCode( BinaryGolayCode() );
-->
<ManSection>
<Func Name="IsMDSCode" Arg=" C "/>
<Description>
<C>IsMDSCode(C)</C> returns true if <A>C</A> is a
maximum distance separable (MDS) code.
A linear <M>[n, k, d]</M>-code of length
<M>n</M>, dimension <M>k</M> and minimum distance <M>d</M>
is an MDS code if <M>k=n-d+1</M>, in other words
if <A>C</A> meets the Singleton bound
(see <Ref Func="UpperBoundSingleton" Style="Number"/>). An unrestricted
<M>(n, M, d)</M> code is called <E>MDS</E>
if <M>k=n-d+1</M>, with <M>k</M> equal
to the largest integer less than or equal
to the logarithm of <M>M</M> with base
<M>q</M>, the size of the base field of <A>C</A>.
<P/>
Well-known MDS codes include the repetition codes, the whole space codes,
the even weight codes (these are the only <E>binary</E> MDS codes) and the
Reed-Solomon codes.
</Description>
</ManSection>
<Index>code, maximum distance separable</Index>
<Index>MDS</Index>
<Example>
gap> C1 := ReedSolomonCode( 6, 3 );
a cyclic [6,4,3]2 Reed-Solomon code over GF(7)
gap> IsMDSCode( C1 ); # verify it is an MDS code, as 6-3+1 = 4
true
gap> IsMDSCode( QRCode( 23, GF(2) ) );
false
</Example> <!-- C1 := ReedSolomonCode( 6, 3 ); IsMDSCode( C1 ); IsMDSCode( QRCode( 23, GF(2) ) );
-->
<ManSection>
<Func Name="IsSelfDualCode" Arg=" C "/>
<Description>
<C>IsSelfDualCode(C)</C> returns `true' if C is self-dual,
i.e. when <A>C</A> is equal to its dual code
(see also <Ref Func="DualCode" Style="Number"/>).
A code is self-dual if it contains
all vectors that its elements are orthogonal to.
If a code is self-dual, it automatically
is self-orthogonal (see
<Ref Func="IsSelfOrthogonalCode" Style="Number"/>).
<P/>
If <A>C</A> is a non-linear code, it cannot be self-dual
(the dual code is always linear), so `false' is
returned. A linear code can only be self-dual when its
dimension <M>k</M> is equal to the redundancy <M>r</M>.
</Description>
</ManSection>
<Index>code, self-dual</Index>
<Example>
gap> IsSelfDualCode( ExtendedBinaryGolayCode() );
true
gap> C := ReedMullerCode( 1, 3 );
a linear [8,4,4]2 Reed-Muller (1,3) code over GF(2)
gap> DualCode( C ) = C;
true
</Example>
<Index>
self-orthogonal
</Index>
<ManSection>
<Func Name="IsSelfOrthogonalCode" Arg=" C "/>
<Description>
<C>IsSelfOrthogonalCode(C)</C> returns `true' if C
is self-orthogonal. A code is <E>self-orthogonal</E>
if every element of <A>C</A> is orthogonal to all
elements of <A>C</A>, including itself. (In the linear case, this simply means
that the generator matrix of <A>C</A> multiplied with its transpose yields a
null matrix.)
</Description>
</ManSection>
<Index>code, self-orthogonal</Index>
<Example>
gap> R := ReedMullerCode(1,4);
a linear [16,5,8]6 Reed-Muller (1,4) code over GF(2)
gap> IsSelfOrthogonalCode(R);
true
gap> IsSelfDualCode(R);
false
</Example> <!-- R := ReedMullerCode(1,4); IsSelfOrthogonalCode(R); IsSelfDualCode(R);
-->
<Index>
doubly-even
</Index>
<ManSection>
<Func Name="IsDoublyEvenCode" Arg=" C "/>
<Description>
<C>IsDoublyEvenCode(C)</C> returns `true' if C is
a binary linear code which has codewords of weight divisible
by 4 only. According to <Cite Key="HP03"/>, a doubly-even code
is self-orthogonal and every row in its generator matrix has
weight that is divisible by 4.
</Description>
</ManSection>
<Index>code, doubly-even</Index>
<ManSection>
<Func Name="IsSinglyEvenCode" Arg=" C "/>
<Description>
<C>IsSinglyEvenCode(C)</C> returns `true' if C is
a binary self-orthogonal linear code which is not doubly-even.
In other words, <A>C</A> is a binary self-orthogonal code which
--> --------------------
--> maximum size reached
--> --------------------
¤ Dauer der Verarbeitung: 0.57 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.