Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 91213ddcfbe7f54821d42c2d9e091326 > files > 2144

gap-system-packages-4.4.12-5mdv2010.0.i586.rpm

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>GAP (orb) - Chapter 6: Random elements</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="generator" content="GAPDoc2HTML" />
<link rel="stylesheet" type="text/css" href="manual.css" />
</head>
<body>


<div class="chlinktop"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a>  <a href="chap1.html">1</a>  <a href="chap2.html">2</a>  <a href="chap3.html">3</a>  <a href="chap4.html">4</a>  <a href="chap5.html">5</a>  <a href="chap6.html">6</a>  <a href="chap7.html">7</a>  <a href="chap8.html">8</a>  <a href="chap9.html">9</a>  <a href="chap10.html">10</a>  <a href="chapBib.html">Bib</a>  <a href="chapInd.html">Ind</a>  </div>

<div class="chlinkprevnexttop">&nbsp;<a href="chap0.html">Top of Book</a>&nbsp;  &nbsp;<a href="chap5.html">Previous Chapter</a>&nbsp;  &nbsp;<a href="chap7.html">Next Chapter</a>&nbsp;  </div>

<p><a id="X8151A51884B7EE2C" name="X8151A51884B7EE2C"></a></p>
<div class="ChapSects"><a href="chap6.html#X8151A51884B7EE2C">6 <span class="Heading">Random elements</span></a>
<div class="ContSect"><span class="nocss">&nbsp;</span><a href="chap6.html#X83F87C898304A0C8">6.1 <span class="Heading">Randomizing mutable objects</span></a>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap6.html#X83DD8B39864A2C94">6.1-1 Randomize</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap6.html#X7BBA80B882867C36">6.1-2 MakeRandomVectors</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap6.html#X7DF0A6E885A4EE42">6.1-3 MakeRandomLines</a></span>
</div>
<div class="ContSect"><span class="nocss">&nbsp;</span><a href="chap6.html#X7B46C06479401BED">6.2 <span class="Heading">Product replacement</span></a>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap6.html#X8290E4C57DE25CD4">6.2-1 ProductReplacer</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap6.html#X7AB4297E78216855">6.2-2 Next</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap6.html#X7EAED8EB78CCEDE2">6.2-3 Reset</a></span>
</div>
</div>

<h3>6 <span class="Heading">Random elements</span></h3>

<p>In this chapter we describe some fundamental mechanisms to produce (pseudo-) random elements that are used later in Chapter <a href="chap7.html#X7DF379C283FE23EF"><b>7</b></a> about searching in groups and orbits.</p>

<p><a id="X83F87C898304A0C8" name="X83F87C898304A0C8"></a></p>

<h4>6.1 <span class="Heading">Randomizing mutable objects</span></h4>

<p>For certain types of mutable objects one can get a "random one" by calling the following operation:</p>

<p><a id="X83DD8B39864A2C94" name="X83DD8B39864A2C94"></a></p>

<h5>6.1-1 Randomize</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; Randomize</code>( <var class="Arg">ob[, rs]</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><b>Returns: </b>nothing</p>

<p>The mutable object <var class="Arg">ob</var> is changed in place. The value afterwards is random. The optional second argument <var class="Arg">rs</var> must be a random source and the random numbers used to randomize <var class="Arg">ob</var> are created using the random source <var class="Arg">rs</var> (see <a href="/scratch/neunhoef/gap4r4/doc/htm/ref/CHAP014.htm#SECT005"><b>Reference: Random Sources</b></a>). If <var class="Arg">rs</var> is not given, then the global <strong class="pkg">GAP</strong> random number generator is used.</p>

<p>Currently, there are <code class="func">Randomize</code> methods for compressed vectors and compressed matrices over finite fields. See also the <strong class="pkg">cvec</strong> package for methods for <code class="code">cvec</code>s and <code class="code">cmat</code>s.</p>

<p>For vectors and one-dimensional subspaces there are two special functions to create a list of random objects:</p>

<p><a id="X7BBA80B882867C36" name="X7BBA80B882867C36"></a></p>

<h5>6.1-2 MakeRandomVectors</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; MakeRandomVectors</code>( <var class="Arg">sample, number[, rs]</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p><b>Returns: </b>a list of random vectors</p>

<p><var class="Arg">sample</var> must be a vector for the mutable copies of which <code class="func">Randomize</code> (<a href="chap6.html#X83DD8B39864A2C94"><b>6.1-1</b></a>) is applicable and <var class="Arg">number</var> must be a positive integer. If given, <var class="Arg">rs</var> must be a random source. This function creates a list of <var class="Arg">number</var> random vectors with the same type as <var class="Arg">sample</var> using <code class="func">Randomize</code> (<a href="chap6.html#X83DD8B39864A2C94"><b>6.1-1</b></a>). For the creation of random numbers the random source <var class="Arg">rs</var> is used or, if not given, the global <strong class="pkg">GAP</strong> random number generator.</p>

<p><a id="X7DF0A6E885A4EE42" name="X7DF0A6E885A4EE42"></a></p>

<h5>6.1-3 MakeRandomLines</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; MakeRandomLines</code>( <var class="Arg">sample, number[, rs]</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p><b>Returns: </b>a list of normalised random vectors</p>

<p><var class="Arg">sample</var> must be a vector for the mutable copies of which <code class="func">Randomize</code> (<a href="chap6.html#X83DD8B39864A2C94"><b>6.1-1</b></a>) is applicable and <var class="Arg">number</var> must be a positive integer. If given, <var class="Arg">rs</var> must be a random source. This function creates a list of <var class="Arg">number</var> normalised random vectors with the same type as <var class="Arg">sample</var> using <code class="func">Randomize</code> (<a href="chap6.html#X83DD8B39864A2C94"><b>6.1-1</b></a>). "Normalised" here means that the first non-zero entry in the vector is equal to 1. For the creation of random numbers the random source <var class="Arg">rs</var> is used or, if not given, the global <strong class="pkg">GAP</strong> random number generator.</p>

<p><a id="X7B46C06479401BED" name="X7B46C06479401BED"></a></p>

<h4>6.2 <span class="Heading">Product replacement</span></h4>

<p>For computations in finite groups product replacement algorithms are a viable method of generating pseudo-random elements. This section describes a framework and an object type to provide these algorithms. Roughly speaking a "product replacer object" is something that is created with a list of group generators and produces a sequence of pseudo random group elements using some random source for random numbers.</p>

<p><a id="X8290E4C57DE25CD4" name="X8290E4C57DE25CD4"></a></p>

<h5>6.2-1 ProductReplacer</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; ProductReplacer</code>( <var class="Arg">gens[, opt]</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><b>Returns: </b>a new product replacer object</p>

<p><var class="Arg">gens</var> must be a list of group generators. If given, <var class="Arg">opt</var> is a <strong class="pkg">GAP</strong> record with options. The operation creates a new product replacer object producing pseudo random elements in the group generated by the generators <var class="Arg">gens</var>.</p>

<p>The exact algorithm used is explained below after the description of the options.</p>

<p>The following components in the options record have a defined meaning:</p>


<dl>
<dt><strong class="Mark"><code class="code">randomsource</code></strong></dt>
<dd><p>A random source object that is used to generate the random numbers used. If none is specified the global <strong class="pkg">GAP</strong> random number generator is used.</p>

</dd>
<dt><strong class="Mark"><code class="code">scramble</code></strong></dt>
<dd><p>The <code class="code">scramble</code> value in the algorithm described below can be set using this option. The default value is 100.</p>

</dd>
<dt><strong class="Mark"><code class="code">scramblefactor</code></strong></dt>
<dd><p>The <code class="code">scramblefactor</code> value in the algorithm described below can be set using this option. The default value is 10.</p>

</dd>
<dt><strong class="Mark"><code class="code">addslots</code></strong></dt>
<dd><p>The <code class="code">addslots</code> value in the algorithm described below can be set using this option. The default value is 10.</p>

</dd>
<dt><strong class="Mark"><code class="code">maxdepth</code></strong></dt>
<dd><p>If <code class="code">maxdepth</code> is set, then the production of pseudo random elements starts all over whenever <code class="code">maxdepth</code> product replacements have been performed. The rationale behind this is that the elements created should be evenly distributed but that the expressions in the generators should not be too long. A good compromise is usually to set <code class="code">maxdepth</code> to 200 or 300.</p>

</dd>
<dt><strong class="Mark"><code class="code">noaccu</code></strong></dt>
<dd><p>Without this option set to <code class="keyw">true</code> the "rattle" version of product replacement is used which involves an accumulator and uses two products per random element. To use the "shake" version with only one product replacement per random element set this component to <code class="keyw">true</code>.</p>

</dd>
<dt><strong class="Mark"><code class="code">normalin</code></strong></dt>
<dd><p>There is a variant of the product replacement algorithm that produces elements in the normal closure of the group generated by a list of elements. It needs random elements in the ambient group in which the normal closure is defined. This is implemented here by setting the <code class="code">normalin</code> component to a product replacer object working in the ambient group. It is recommended to switch off the accumulator in the product replacer object for the ambient group. Then to produce one random element in the normal closure needs three multiplications.</p>

</dd>
</dl>
<p>The algorithm used does the following: A list of <code class="code">Length(</code><var class="Arg">gens</var><code class="code">)+addslots</code> elements is created that starts with the elements <var class="Arg">gens</var> and is filled up with random generators from <var class="Arg">gens</var>. A product replacement randomly chooses two elements in the list and replaces one of them by the product of the two. One step in the algorithm is to do one product replacement followed by post-multiplying the result to the accumulator if one is used. First <code class="code">Maximum(Length(</code><var class="Arg">gens</var><code class="code">)*scramblefactor,scramble)</code> steps are performed. After this initialisation for every random element requested one step is done done and the resulting element returned.</p>

<p><a id="X7AB4297E78216855" name="X7AB4297E78216855"></a></p>

<h5>6.2-2 Next</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; Next</code>( <var class="Arg">pr</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><b>Returns: </b>a (pseudo-) random group element g</p>

<p><var class="Arg">pr</var> must be a product replacer object. This operation makes the object generate the next random element and return it.</p>

<p><a id="X7EAED8EB78CCEDE2" name="X7EAED8EB78CCEDE2"></a></p>

<h5>6.2-3 Reset</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; Reset</code>( <var class="Arg">pr</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><b>Returns: </b>nothing</p>

<p><var class="Arg">pr</var> must be a product replacer object. This operation resets the object in the sense that it resets its random source (see <code class="func">Reset</code>) and reinitialises the random element generation as described above.</p>


<div class="chlinkprevnextbot">&nbsp;<a href="chap0.html">Top of Book</a>&nbsp;  &nbsp;<a href="chap5.html">Previous Chapter</a>&nbsp;  &nbsp;<a href="chap7.html">Next Chapter</a>&nbsp;  </div>


<div class="chlinkbot"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a>  <a href="chap1.html">1</a>  <a href="chap2.html">2</a>  <a href="chap3.html">3</a>  <a href="chap4.html">4</a>  <a href="chap5.html">5</a>  <a href="chap6.html">6</a>  <a href="chap7.html">7</a>  <a href="chap8.html">8</a>  <a href="chap9.html">9</a>  <a href="chap10.html">10</a>  <a href="chapBib.html">Bib</a>  <a href="chapInd.html">Ind</a>  </div>

<hr />
<p class="foot">generated by <a href="http://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc">GAPDoc2HTML</a></p>
</body>
</html>