<h3>2 <span class="Heading">A First Tutorial in <strong class="pkg">GUAVA</strong></span></h3>
<p>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>
<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 <span class="SimpleMath">\(n\)</span>. Such codes are known as <em>Linear Codes</em>, 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 <em>not</em> "in the code") will be assumed to be a codeword that has been mangled by the addition of noise.</p>
<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 <em>we put them back the way they were supposed to be!</em></p>
<p>That process is called "decoding." Developing codes that have efficient decoding algorithms is one of the central problems of algebraic coding theory.</p>
<p><strong class="pkg">GUAVA</strong> 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>
<p>The previous excerpt from a <strong class="pkg">GAP</strong> 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 <code class="file">Weight</code> which (if it isn't obvious) tells us how many entries in a codeword are non-zero.
<p>The <em>Hamming distance</em> is used extensively in coding theory. It tells us in how many positions two codewords differ. In <strong class="pkg">GUAVA</strong> the Hamming distance is implemented by a function called <code class="file">DistanceCodeword</code>.</p>
<p>Note that the Hamming distance between <code class="code">c1</code> and <code class="code">c2</code> 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>
<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 <strong class="pkg">GUAVA</strong> functions that allow one to switch back and forth between the two representations.</p>
<h4>2.2 <span class="Heading">Calculations with codes</span></h4>
<p>A code is fundamentally just a collection of codewords. Sometimes a code is merely a <em>set</em> of codewords. Other times a code will be the vector space generated by some small set of codewords.</p>
<p>In this example we first wrote out a list of strings, then converted them into codewords over GF(2). The call to <code class="file">ElementsCode</code> 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 <code class="file">IsLinearCode</code> 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>
<p>A very useful feature of <strong class="pkg">GUAVA</strong> is the ability to construct random codes:</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">C:= RandomLinearCode(12,5,GF(2));</span>
a [12,5,?] randomly generated code over GF(2)
</pre></div>
<p>An error-correcting code's properties are fairly well captured by three numbers which traditionally are referred to using the letters \(n\), \(k\) and \(d\). We ask for a random code by specifying \(n\) (the wordlength), and \(k\) (the code's dimension) as well as the field which serves as the alphabet for the code.</p>
<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, <span class="SimpleMath">\(d\)</span>. This is the smallest weight of any nonzero word in the code. If we wish to correct <span class="SimpleMath">\(m\)</span> errors we will need to have a minimum weight of at least <span class="SimpleMath">\(2m+1\)</span>.</p>
<p>This particular code would be capable of correcting single bit errors.</p>
<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 <span class="SimpleMath">\(0\)</span> and <span class="SimpleMath">\(n\)</span>.</p>
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.