Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/pkg/gradedmodules/examples/doc/   (Algebra von RWTH Aachen Version 4.15.1©) image not shown  

Quellcode-Bibliothek chap4_mj.html   Interaktion und
PortierbarkeitHTML

 
 products/Sources/formale Sprachen/GAP/pkg/resclasses/doc/chap4_mj.html


<?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>
<script type="text/javascript"
  src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<title>GAP (ResClasses) - Chapter 4: Installation and Auxiliary Functions</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" />
<script src="manual.js" type="text/javascript"></script>
<script type="text/javascript">overwriteStyle();</script>
</head>
<body class="chap4"  onload="jscontent()">


<div class="chlinktop"><span class="chlink1">Goto Chapter: </span><a href="chap0_mj.html">Top</a>  <a href="chap1_mj.html">1</a>  <a href="chap2_mj.html">2</a>  <a href="chap3_mj.html">3</a>  <a href="chap4_mj.html">4</a>  <a href="chapBib_mj.html">Bib</a>  <a href="chapInd_mj.html">Ind</a>  </div>

<div class="chlinkprevnexttop"> <a href="chap0_mj.html">[Top of Book]</a>   <a href="chap0_mj.html#contents">[Contents]</a>    <a href="chap3_mj.html">[Previous Chapter]</a>    <a href="chapBib_mj.html">[Next Chapter]</a>   </div>

<p id="mathjaxlink" class="pcenter"><a href="chap4.html">[MathJax off]</a></p>
<p><a id="X859F6BF88754E5CC" name="X859F6BF88754E5CC"></a></p>
<div class="ChapSects"><a href="chap4_mj.html#X859F6BF88754E5CC">4 <span class="Heading">Installation and Auxiliary Functions</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap4_mj.html#X85A08CF187A6D986">4.1 <span class="Heading">Requirements</span></a>
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap4_mj.html#X8360C04082558A12">4.2 <span class="Heading">Installation</span></a>
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap4_mj.html#X865D6A49826B92EC">4.3 <span class="Heading">The testing routines</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap4_mj.html#X8733F00082901C2C">4.3-1 ResClassesTest</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap4_mj.html#X802034807F5D6C47">4.3-2 ResClassesTestExamples</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap4_mj.html#X7B0129E185088420">4.4 <span class="Heading">Creating timestamped logfiles</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap4_mj.html#X7B023FD184CC118D">4.4-1 LogToDatedFile</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap4_mj.html#X81DD0163859E9EF5">4.5 <span class="Heading">DownloadFile, SendEmail and EmailLogFile</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap4_mj.html#X7C1543408472A82B">4.5-1 DownloadFile</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap4_mj.html#X7F27919085001EA8">4.5-2 SendEmail</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap4_mj.html#X8000E5CF7DF4339C">4.5-3 EmailLogFile</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap4_mj.html#X855F2CE284BFB06B">4.6 <span class="Heading">Creating bitmap pictures</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap4_mj.html#X81DE1E838615C214">4.6-1 SaveAsBitmapPicture</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap4_mj.html#X83D7129581B8CF21">4.6-2 DrawLineNC</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap4_mj.html#X808A30E37A293D19">4.7 <span class="Heading">Some general utility functions</span></a>
</span>
</div>
</div>

<h3>4 <span class="Heading">Installation and Auxiliary Functions</span></h3>

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

<h4>4.1 <span class="Heading">Requirements</span></h4>

<p>This version of <strong class="pkg">ResClasses</strong> needs at least <strong class="pkg">GAP</strong> 4.9.0, <strong class="pkg">Polycyclic</strong> 2.11 <a href="chapBib_mj.html#biBPolycyclic">[EHN13]</a>, <strong class="pkg">GAPDoc</strong> 1.5.1 <a href="chapBib_mj.html#biBGAPDoc">[LN12]</a> and <strong class="pkg">Utils</strong> 0.40 <a href="chapBib_mj.html#biBUtils">[GKW16]</a>. It can be used on all platforms for which <strong class="pkg">GAP</strong> is available. <strong class="pkg">ResClasses</strong> is completely written in the <strong class="pkg">GAP</strong> language and does neither contain nor require external binaries.</p>

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

<h4>4.2 <span class="Heading">Installation</span></h4>

<p>Like any other <strong class="pkg">GAP</strong> package, <strong class="pkg">ResClasses</strong> is usually installed in the <code class="file">pkg</code> subdirectory of the <strong class="pkg">GAP</strong> distribution. This is accomplished by extracting the distribution file in this directory. By default, the package <strong class="pkg">ResClasses</strong> is autoloaded. If you have switched autoloading of packages off, you can load <strong class="pkg">ResClasses</strongvia <code class="code">LoadPackage( "resclasses" );</code>.</p>

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

<h4>4.3 <span class="Heading">The testing routines</span></h4>

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

<h5>4.3-1 ResClassesTest</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ResClassesTest</code>(  )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: <code class="code">true</code> if no errors were found, and <code class="code">false</code> otherwise.</p>

<p>Performs tests of the <strong class="pkg">ResClasses</strong> package. Errors, i.e. differences to the correct results of the test computations, are reported. The processed test files are in the directory <code class="file">pkg/resclasses/tst</code>.</p>

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

<h5>4.3-2 ResClassesTestExamples</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ResClassesTestExamples</code>(  )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: nothing.</p>

<p>Runs all examples in the manual of the <strong class="pkg">ResClasses</strong> package, and reports any differences between the actual output and the output printed in the manual.</p>

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

<h4>4.4 <span class="Heading">Creating timestamped logfiles</span></h4>

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

<h5>4.4-1 LogToDatedFile</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ LogToDatedFile</code>( <var class="Arg">directory</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: the full pathname of the created logfile.</p>

<p>This function opens a logfile in the specified directory; the name of the logfile has the form of a timestamp, i.e. <code class="code">year-month-day hour-minute-second.log.</code> If <strong class="pkg">GAP</strong> is already in logging mode, the old logfile is closed before the new one is opened.</p>

<p>The availability of this function depends on that the package <strong class="pkg">IO</strong> <a href="chapBib_mj.html#biBIO">[HN16]</a> is installed and compiled.</p>

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

<h4>4.5 <span class="Heading">DownloadFile, SendEmail and EmailLogFile</span></h4>

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

<h5>4.5-1 DownloadFile</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ DownloadFile</code>( <var class="Arg">url</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: the contents of the file with URL <var class="Arg">url</var> in the form of a string if that file exists and the download was successful, and <code class="code">fail</code> otherwise.</p>

<p>As most system-related functions, <code class="code">DownloadFile</code> works only under UNIX / Linux. Also the computer must of course be connected to the Internet.</p>

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

<h5>4.5-2 SendEmail</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SendEmail</code>( <var class="Arg">sendto</var>, <var class="Arg">copyto</var>, <var class="Arg">subject</var>, <var class="Arg">text</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: zero if everything worked correctly, and a system error number otherwise.</p>

<p>Sends an e-mail with subject <var class="Arg">subject</var> and body <var class="Arg">text</var> to the addresses in the list <var class="Arg">sendto</var>, and copies it to those in the list <var class="Arg">copyto</var>. The first two arguments must be lists of strings, and the latter two must be strings.</p>

<p>As most system-related functions, <code class="code">SendEmail</code> works only under UNIX / Linux. Also the computer must of course be connected to the Internet.</p>

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

<h5>4.5-3 EmailLogFile</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ EmailLogFile</code>( <var class="Arg">addresses</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: zero if everything worked correctly, and a system error number otherwise.</p>

<p>Sends the current log file by e-mail to <var class="Arg">addresses</var>, if <strong class="pkg">GAP</strong> is in logging mode and one is working under UNIX / Linux, and does nothing otherwise. The argument <var class="Arg">addresses</var> must be either a list of e-mail addresses or a single e-mail address. Long log files are abbreviated, i.e. if the log file is larger than 64KB, then any output is truncated at 1KB, and if the log file is still longer than 64KB afterwards, it is truncated at 64KB.</p>

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

<h4>4.6 <span class="Heading">Creating bitmap pictures</span></h4>

<p><strong class="pkg">ResClasses</strong> provides functions to generate bitmap picture files from suitable pixel matrices and vice versa. The author has successfully tested this feature both under Linux and under Windows, and the generated pictures can be processed further with many common graphics programs:</p>

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

<h5>4.6-1 SaveAsBitmapPicture</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SaveAsBitmapPicture</code>( <var class="Arg">picture</var>, <var class="Arg">filename</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: nothing.</p>

<p>Writes the pixel matrix <var class="Arg">picture</var> to a bitmap- (bmp-) picture file named <var class="Arg">filename</var>. The filename should include the entire pathname. The argument <var class="Arg">picture</var> can be a GF(2) matrix, in which case a monochrome picture file is generated. In this case, zeros stand for black pixels and ones stand for white pixels. The argument <var class="Arg">picture</var> can also be an integer matrix, in which case a 24-bit true color picture file is generated. In this case, the entries of the matrix are supposed to be integers <span class="SimpleMath">\(n = 65536 \cdot red + 256 \cdot green + blue\)</span> in the range <span class="SimpleMath">\(0, \dots, 2^{24}-1\)</span> specifying the RGB values of the colors of the pixels.</p>

<p>The picture can be read back into <strong class="pkg">GAP</strong> by the function <code class="code">LoadBitmapPicture(<var class="Arg">filename</var>)</code>.</p>


<div class="example"><pre>

<span class="GAPprompt">gap></span> <span class="GAPinput">color   := n->32*(n mod 8)+256*32*(Int(n/8) mod 8)+65536*32*Int(n/64);;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">picture := List([1..512],y->List([1..512],x->color(Gcd(x,y)-1)));;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">SaveAsBitmapPicture(picture,Filename(DirectoryTemporary(),"gcd.bmp"));</span>

</pre></div>

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

<h5>4.6-2 DrawLineNC</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ DrawLineNC</code>( <var class="Arg">pic</var>, <var class="Arg">x1</var>, <var class="Arg">y1</var>, <var class="Arg">x2</var>, <var class="Arg">y2</var>, <var class="Arg">color</var>, <var class="Arg">width</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: nothing.</p>

<p>Draws a line on picture <var class="Arg">pic</var> from (<var class="Arg">x1</var>,<var class="Arg">y1</var>) to (<var class="Arg">x2</var>,<var class="Arg">y2</var>), with color <var class="Arg">color</var> and of width <var class="Arg">width</var>.</p>


<div class="example"><pre>

<span class="GAPprompt">gap></span> <span class="GAPinput">picture := NullMat(100,100)+2^24-1;;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">DrawLineNC(picture,30,20,70,80,255,8);                 </span>
<span class="GAPprompt">gap></span> <span class="GAPinput">SaveAsBitmapPicture(picture,Filename(DirectoryTemporary(),</span>
<span class="GAPprompt">></span> <span class="GAPinput">                       "example.bmp"));</span>

</pre></div>

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

<h4>4.7 <span class="Heading">Some general utility functions</span></h4>

<p><strong class="pkg">ResClasses</strong> provides a few small utility functions and -operations which can be used in a more general context. They are described in this section.</p>

<p>There is an operation <code class="code">PositionsSublist(<var class="Arg">list</var>,<var class="Arg">sub</var>)</code> which returns the list of positions at which <var class="Arg">sub</var> occurs as a sublist of <var class="Arg">list</var>.</p>


<div class="example"><pre>

<span class="GAPprompt">gap></span> <span class="GAPinput">PositionsSublist([1,2,6,2,7,2,7,2,3,1,6,2,7,2,8],[2,7,2]);</span>
[ 4, 6, 12 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">PositionsSublist([1,2,3,4,3,2,1],[1,3,5]);</span>
[  ]
<span class="GAPprompt">gap></span> <span class="GAPinput">PositionsSublist("This is an example, isn't it?","is");   </span>
[ 3, 6, 21 ]

</pre></div>

<p>Also there are methods <code class="code">EquivalenceClasses(<var class="Arg">l</var>,<var class="Arg">inv</var>)</code> and <code class="code">EquivalenceClasses(<var class="Arg">l</var>,<var class="Arg">rel</var>)</code> which decompose a list <var class="Arg">l</var> into equivalence classes under an equivalence relation. The equivalence relation is given either as a function <var class="Arg">inv</var> computing a class invariant of a given list entry or as a function <var class="Arg">rel</var> which takes as arguments two list entries and returns either <code class="code">true</code> or <code class="code">false</code> depending on whether the arguments belong to the same equivalence class or not.</p>


<div class="example"><pre>

<span class="GAPprompt">gap></span> <span class="GAPinput">EquivalenceClasses([2..50],n->Length(Factors(n))); </span>
[ [ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47 ], 
  [ 4, 6, 9, 10, 14, 15, 21, 22, 25, 26, 33, 34, 35, 38, 39, 46, 49 ], 
  [ 8, 12, 18, 20, 27, 28, 30, 42, 44, 45, 50 ], [ 16, 24, 36, 40 ], 
  [ 32, 48 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">EquivalenceClasses(AsList(AlternatingGroup(4)),</span>
<span class="GAPprompt">></span> <span class="GAPinput">                      function ( g, h )</span>
<span class="GAPprompt">></span> <span class="GAPinput">                        return IsConjugate(SymmetricGroup(4),g,h);</span>
<span class="GAPprompt">></span> <span class="GAPinput">                      end);</span>
[ [ (2,3,4), (2,4,3), (1,2,3), (1,2,4), (1,3,2), (1,3,4), (1,4,2), 
      (1,4,3) ], [ (1,2)(3,4), (1,3)(2,4), (1,4)(2,3) ], [ () ] ]

</pre></div>

<p>Further, there is an operation <code class="code">GraphClasses(<var class="Arg">n</var>)</code> which returns a list of isomorphism classes of graphs with vertices <span class="SimpleMath">\(1, 2, \dots, n\)</span>, and an operation <code class="code">AllGraphs(<var class="Arg">n</var>)</code> which returns a list of representatives of these classes. The graphs are represented as lists of edges, where each edge is a list of the two vertices it connects, and they are ordered by ascending number of edges. Given a graph <var class="Arg">graph</var> with <var class="Arg">n</var> vertices, the operation <code class="code">IdGraphNC(<var class="Arg">graph</var>,GraphClasses(<var class="Arg">n</var>))</code> returns the index <code class="code">i</code> such that <var class="Arg">graph</var> lies in <code class="code">GraphClasses(<var class="Arg">n</var>)[i]</code>. For reasons of efficiency, <code class="code">IdGraphNC</code> performs no argument checks.</p>


<div class="example"><pre>

<span class="GAPprompt">gap></span> <span class="GAPinput">GraphClasses(3);</span>
[ [ [  ] ], [ [ [ 1, 2 ] ], [ [ 2, 3 ] ], [ [ 1, 3 ] ] ], 
  [ [ [ 1, 2 ], [ 1, 3 ] ], [ [ 1, 2 ], [ 2, 3 ] ], 
      [ [ 1, 3 ], [ 2, 3 ] ] ], [ [ [ 1, 2 ], [ 1, 3 ], [ 2, 3 ] ] ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">List(last,Length); # sizes of classes</span>
[ 1, 3, 3, 1 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">AllGraphs(4);</span>
[ [  ], [ [ 1, 2 ] ], [ [ 1, 2 ], [ 1, 3 ] ], [ [ 1, 2 ], [ 3, 4 ] ], 
  [ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ] ], [ [ 1, 2 ], [ 1, 3 ], [ 2, 3 ] ], 
  [ [ 1, 2 ], [ 1, 3 ], [ 2, 4 ] ], 
  [ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 2, 3 ] ], 
  [ [ 1, 2 ], [ 1, 3 ], [ 2, 4 ], [ 3, 4 ] ], 
  [ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 2, 3 ], [ 2, 4 ] ], 
  [ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 2, 3 ], [ 2, 4 ], [ 3, 4 ] ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">List(last,Length); # numbers of edges</span>
[ 0, 1, 2, 2, 3, 3, 3, 4, 4, 5, 6 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">IdGraphNC([[1,3],[1,8],[3,8]],GraphClasses(4)); # a triangle graph</span>
6
<span class="GAPprompt">gap></span> <span class="GAPinput">AllGraphs(4)[last];</span>
[ [ 1, 2 ], [ 1, 3 ], [ 2, 3 ] ]

</pre></div>


<div class="chlinkprevnextbot"> <a href="chap0_mj.html">[Top of Book]</a>   <a href="chap0_mj.html#contents">[Contents]</a>    <a href="chap3_mj.html">[Previous Chapter]</a>    <a href="chapBib_mj.html">[Next Chapter]</a>   </div>


<div class="chlinkbot"><span class="chlink1">Goto Chapter: </span><a href="chap0_mj.html">Top</a>  <a href="chap1_mj.html">1</a>  <a href="chap2_mj.html">2</a>  <a href="chap3_mj.html">3</a>  <a href="chap4_mj.html">4</a>  <a href="chapBib_mj.html">Bib</a>  <a href="chapInd_mj.html">Ind</a>  </div>

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

100%


¤ 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.0.22Bemerkung:  Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können  ¤

*Eine klare Vorstellung vom Zielzustand






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.