<p>The <strong class="pkg">ALCO</strong> package provides some basic tools to compute the closure of a set with respect to a binary operation. Some of these tools compute the closure by brute force, while others use random selection of pairs to attempt to find new members not in the set.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Closure</code>( <var class="Arg">gens</var>, <var class="Arg">op</var>[, <var class="Arg">option</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<p>For <var class="Arg">gens</var> satisfying <code class="code">IsHomogeneousList</code>, this function computes the closure of <var class="Arg">gens</var> by addition of all elements of the form <code class="code"><var class="Arg">op</var>(x,y)</code>, starting with <code class="code">x</code> and <code class="code">y</code> any elements in <var class="Arg">gens</var>. The function will not terminate until no new members are produced when applying <var class="Arg">op</var> to all ordered pairs of generated elements. The argument <var class="Arg">option</var>, if supplied, ensures that the function treats <var class="Arg">op</var> as a commutative operation.</p>
<p>Caution must be exercised when using this function to prevent attempting to compute the closure of large or possibly infinite sets.</p>
<p>In many cases the <code class="func">Closure</code> (<a href="chap6_mj.html#X87E8AA6582245C3E"><span class="RefLink">6.1-1</span></a>) function is impractical to use due to the long computation time of the brute force method. The following functions provide tools to generate more elements of a set under a binary operation without directly proving closure.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RandomElementClosure</code>( <var class="Arg">gens</var>, <var class="Arg">op</var>[, <var class="Arg">N</var>[, <var class="Arg">print</var>]] )</td><td class="tdright">( function )</td></tr></table></div>
<p>For <var class="Arg">gens</var> satisfying <code class="code">IsHomogeneousList</code>, this function selects a random element <var class="Arg">r</var> in <var class="Arg">gens</var> and computes all elements of the form <code class="code"><var class="Arg"> op</var>(<var class="Arg">r</var>,<varclass="Arg">x</var>)</code> for <var class="Arg">x</var> either in <var class="Arg">gens</var> or obtained in a previous closure step. Once this process yields a set of elements with equal cardinality <code class="code"><var class="Arg">N</var>+1</code> times, the function terminates and returns all elements obtained so far as a set. The default value of <var class="Arg">N</var> is <code class="code">1</code>. The optional <var class="Arg">print</var> argument, if supplied, prints the cardinality of the set of elements obtain so far at each iteration.</p>
<p>Caution must be exercised when using this function to prevent attempting to compute the random closure of an infinite set. Caution is also required in interpreting the output. Even for large values of <var class="Arg">N</var>, the result is not necessarily the full closure of set <var class="Arg">gens</var>. Furthermore, repeated calls to this function may result in different outputs due to the random selection of elements involved throughout. If the size of the expected closed set is known, use of a <code class="code">repeat</code>-<code class="code">until</code> loop can permit generating the full set of elements faster than <code class="func">Closure</code> (<a href="chap6_mj.html#X87E8AA6582245C3E"><span class="RefLink">6.1-1</span></a>) would.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RandomOrbitOnSets</code>( <var class="Arg">gens</var>, <var class="Arg">start</var>, <var class="Arg">op</var>[, <var class="Arg">N</var>[, <var class="Arg">print</var>]] )</td><td class="tdright">( function )</td></tr></table></div>
<p>This function proceeds in a manner very similar to <code class="func">RandomElementClosure</code> (<a href="chap6_mj.html#X78DC531B815591E8"><span class="RefLink">6.2-1</span></a>) with the following differences. This function instead selects a random element <var class="Arg">r</var> in <var class="Arg">gens</var> and then for every <var class="Arg">x</var> in <var class="Arg">start</var>, or the set of previously generated elements, computes <code class="code"><var class="Arg">op</var>(<var class="Arg">r</var>,<var class="Arg">x</var>)</code>. At each step the cardinality of the union of <var class="Arg">start</var> and any previously generated elements is computed. Once the cardinality is fixed for <var class="Arg">N + 1</var> steps, the function returns the set of generated elements.</p>
<p>The same cautions as described in <code class="func">RandomElementClosure</code> (<a href="chap6_mj.html#X78DC531B815591E8"><span class="RefLink">6.2-1</span></a>) apply. Note that while <var class="Arg">start</var> is always a subset of the output, the elements of <var class="Arg">gens</var> are not necessarily included in the output.</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.