| products/Sources/formale Sprachen/GAP/pkg/polymaking/doc/chap4.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>
< title>GAP (polymaking) - Chapter 4: Converting Polymake Output</ 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.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="chapBib.html">Bib</a> <a href="chapInd.html">Ind</a> </div>
<div class="chlinkprevnexttop"> <a href="chap0.html">[Top of Book]</a> <a href="chap0.html#contents">[Contents]</a> <a href="chap3.html">[Previous Chapter]</a> <a href="chapBib.html">[Next Chapter]</a> </div>
<p id="mathjaxlink" class="pcenter"><a href="chap4_mj.html">[MathJax on]</a></p>
<p><a id="X7D23E80E841CDD67" name="X7D23E80E841CDD67"></a></p>
<div class="ChapSects"><a href="chap4.html#X7D23E80E841CDD67">4 <span class="Heading">Converting Polymake Output</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap4.html#X862D57D87A244DE2">4.1 <span class="Heading">The General Method</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap4.html#X7CDBEA427EE69C71">4.1-1 <span class="Heading">Converter- Philosopy</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap4.html#X7EB6D80C816CF667">4.1-2 ConvertPolymakeOutputToGapNotation</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap4.html#X841D81327C6F6E29">4.1-3 SplitPolymakeOutputStringIntoBlocks</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap4.html#X83199F737F4BE4FD">4.1-4 ObjectConverters</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap4.html#X7FF4170183C83CC1">4.2 <span class="Heading">Conversion Functions</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap4.html#X7FC98443862DB83F">4.2-1 ConvertPolymakeNumber</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap4.html#X7F2A1C2C808E4A07">4.2-2 ConvertPolymakeScalarToGAP</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap4.html#X82A7FF9983EB61E2">4.2-3 ConvertPolymakeMatrixOrListOfSetsToGAP</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap4.html#X817C6B4180BF6365">4.2-4 ConvertPolymakeMatrixToGAP</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap4.html#X85F7F6787D346CC0">4.2-5 ConvertPolymakeVectorToGAP</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap4.html#X87B6F9867EE800C7">4.2-6 ConvertPolymakeBoolToGAP</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap4.html#X846B284085825FEA">4.2-7 ConvertPolymakeSetToGAP</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap4.html#X7E7886D68356F592">4.2-8 ConvertPolymakeListOfSetsToGAP</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap4.html#X7EBECAA07F8B58D8">4.2-9 ConvertPolymakeGraphToGAP</a></span>
</div></div>
</div>
<h3>4 <span class="Heading">Converting Polymake Output</span></h3>
<p><a id="X862D57D87A244DE2" name="X862D57D87A244DE2"></a></p>
<h4>4.1 <span class="Heading">The General Method</span></h4>
<p>When polymake is called, its output is read as a string and then processed as follows:</p>
<ol>
<li><p>the lines containing upper case letters are found. These are treated as lines containing the keywords. Each of those lines marks the beginning of a block of data.</p>
</li>
<li><p>The string is then cut into a list of blocks (also strings). Each block starts with a line containing the keyword and continues with some lines of data.</p>
</li>
<li><p>for each of the blocks, the appropriate function of <code class="code">ObjectConverters</code> is called. Here "appropriate" just means, that the keyword of the block coincides with the name of the function.</p>
</li>
<li><p>The output of the conversion function is then added to the known properties of the <code class="code">PolymakeObject</code> for which <code class="code">Polymake</code> was called.</p>
</li>
</ol>
<p><a id="X7CDBEA427EE69C71" name="X7CDBEA427EE69C71"></a></p>
<h5>4.1-1 <span class="Heading">Converter- Philosopy</span></h5>
<p>The converter functions should take meaningful polymake data into meaningful <strong class="pkg">GAP</strong> data. This sometimes means that the (mathematical) representation is changed. Here is an example: polymake writes vectors as augmented affine vectors of the form <code class="code">1 a1 a2 a3...</code> which does not go very well with the usual <strong class="pkg">GAP</strong> conventions of column vectors and multiplying matrices from the right. So <strong class="pkg">polymaking</strong> converts such a vector to <code class="code">[a1,a2,a3,...]</code> and the user is left with the problem of augmentation and left or right multiplication.</p>
<p>Another area where the <strong class="pkg">GAP</strong> object isn't a literal translation from the polymake world is combinatorics. In Polymake, list elements are enumerated starting from 0. <strong class="pkg">GAP</strong> enumerates lists starting at 1. So the conversion process adds 1 to the numbers corresponding to vertices in facet lists, for example.</p>
<p>The conversion process is done by the following methods:</p>
<p><a id="X7EB6D80C816CF667" name="X7EB6D80C816CF667"></a></p>
<h5>4.1-2 ConvertPolymakeOutputToGapNotation</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">an style='color: green'>8227; ConvertPolymakeOutputToGapNotation</code>( <var class="Arg">string</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: Record having polymake keywords as entry names and the respective converted polymake output as entries.</p>
<p>Given a the output of the polymake program as a string <var class="Arg">string</var>, this method first calls <code class="func">SplitPolymakeOutputStringIntoBlocks</code> (<a href="chap4.html#X841D81327C6F6E29"><span class="RefLink">4.1-3</span></a>). For each of the returned blocks, the name (=first line) of the block is read and the record <code class="func">ObjectConverters</code> (<a href="chap4.html#X83199F737F4BE4FD"><span class="RefLink">4.1-4</span></a>) is looked up for an entry with that name. If such an entry exists, it (being a function!) is called and passed the block. The returned value is then given the name of the block and added to the record returned by <code class="code">ConvertPolymakeOutputToGapNotation</code>.</p>
<p><a id="X841D81327C6F6E29" name="X841D81327C6F6E29"></a></p>
<h5>4.1-3 SplitPolymakeOutputStringIntoBlocks</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">an style='color: green'>8227; SplitPolymakeOutputStringIntoBlocks</code>( <var class="Arg">string</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: List of strings -- "blocks"--</p>
<p>The string <var class="Arg">string</var> is cut at the lines starting with an upper case character and consisting only of upper case letters, numbers and underscore (_) characters. The parts are returned as a list of strings. The initial string <var class="Arg">string</var> remains unchanged.</p>
<p><a id="X83199F737F4BE4FD" name="X83199F737F4BE4FD"></a></p>
<h5>4.1-4 ObjectConverters</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">an style='color: green'>8227; ObjectConverters</code></td><td class="tdright">( global variable )</td></tr></table></div>
<p>The entries of this record are labeled by polymake keywords. Each of the entries is a function which converts a string returned by polymake to <strong class="pkg">GAP</strong> format. So far, only a few converters are implemented. To see which, try <code class="code">RecNames(ObjectConverters);</code></p>
<p>You can define new converters using the basic functions described in section <a href="chap4.html#X7FF4170183C83CC1"><span class="RefLink">4.2</span></a>.</p>
<p><a id="X7FF4170183C83CC1" name="X7FF4170183C83CC1"></a></p>
<h4>4.2 <span class="Heading">Conversion Functions</span></h4>
<p>The following functions are used for the functions in <code class="func">ObjectConverters</code> (<a href="chap4.html#X83199F737F4BE4FD"><span class="RefLink">4.1-4</span></a>).</p>
<p><a id="X7FC98443862DB83F" name="X7FC98443862DB83F"></a></p>
<h5>4.2-1 ConvertPolymakeNumber</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">an style='color: green'>8227; ConvertPolymakeNumber</code>( <var class="Arg">string</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>The string <var class="Arg">string</var> is converted to a rational number. Unlike <code class="code">Rat</code>, it tests, if the number represented by <var class="Arg">string</var> is a floating point number an converts it correctly. If this is the case, a warning is issued.</p>
<p><a id="X7F2A1C2C808E4A07" name="X7F2A1C2C808E4A07"></a></p>
<h5>4.2-2 ConvertPolymakeScalarToGAP</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">an style='color: green'>8227; ConvertPolymakeScalarToGAP</code>( <var class="Arg">list</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>If <var class="Arg">list</var> contains a single string, this string is converted into a number using <code class="func">ConvertPolymakeNumber</code> (<a href="chap4.html#X7FC98443862DB83F"><span class="RefLink">4.2-1</span></a>).</p>
<p><a id="X82A7FF9983EB61E2" name="X82A7FF9983EB61E2"></a></p>
<h5>4.2-3 ConvertPolymakeMatrixOrListOfSetsToGAP</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">an style='color: green'>8227; ConvertPolymakeMatrixOrListOfSetsToGAP</code>( <var class="Arg">list</var> )</td><td class="tdright">( method )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">an style='color: green'>8227; ConvertPolymakeMatrixOrListOfSetsToGAPPlusOne</code>( <var class="Arg">list</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Tries to decide if the list <var class="Arg">list</var> of strings represents a matrix or a list of sets by testing if they start with "{". It then calls either <code class="func">ConvertPolymakeMatrixToGAP</code> (<a href="chap4.html#X817C6B4180BF6365"><span class="RefLink">4.2-4</span></a>) or <code class="func">ConvertPolymakeListOfSetsToGAP</code> (<a href="chap4.html#X7E7886D68356F592"><span class="RefLink">4.2-8</span></a>). The "PlusOne" version calls <code class="func">ConvertPolymakeListOfSetsToGAPPlusOne</code> (<a href="chap4.html#X7E7886D68356F592"><span class="RefLink">4.2-8</span></a>) if <var class="Arg">list</var> represents a list of sets.</p>
<p><a id="X817C6B4180BF6365" name="X817C6B4180BF6365"></a></p>
<h5>4.2-4 ConvertPolymakeMatrixToGAP</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">an style='color: green'>8227; ConvertPolymakeMatrixToGAP</code>( <var class="Arg">list</var> )</td><td class="tdright">( method )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">an style='color: green'>8227; ConvertPolymakeMatrixToGAPKillOnes</code>( <var class="Arg">list</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>The list <var class="Arg">list</var> of strings is interpreted as a list of row vectors and converted into a matrix. The "KillOnes" version removes the leading ones.</p>
<p><a id="X85F7F6787D346CC0" name="X85F7F6787D346CC0"></a></p>
<h5>4.2-5 ConvertPolymakeVectorToGAP</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">an style='color: green'>8227; ConvertPolymakeVectorToGAP</code>( <var class="Arg">list</var> )</td><td class="tdright">( method )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">an style='color: green'>8227; ConvertPolymakeVectorToGAPKillOne</code>( <var class="Arg">list</var> )</td><td class="tdright">( method )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">an style='color: green'>8227; ConvertPolymakeIntVectorToGAPPlusOne</code>( <var class="Arg">list</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>As the corresponding "Matrix" version. Just for vectors. <code class="keyw">ConvertPolymakeIntVectorToGAPPlusOne</code> requires the vector to contain integers. It also adds 1 to every entry.</p>
<p><a id="X87B6F9867EE800C7" name="X87B6F9867EE800C7"></a></p>
<h5>4.2-6 ConvertPolymakeBoolToGAP</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">an style='color: green'>8227; ConvertPolymakeBoolToGAP</code>( <var class="Arg">list</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>If <var class="Arg">list</var> contains a single string, which is either 0,false,1, or true this function returns <code class="keyw">false</code> or <code class="keyw">true</code>, respectively.</p>
<p><a id="X846B284085825FEA" name="X846B284085825FEA"></a></p>
<h5>4.2-7 ConvertPolymakeSetToGAP</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">an style='color: green'>8227; ConvertPolymakeSetToGAP</code>( <var class="Arg">list</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Let <var class="Arg">list</var> be a list containing a single string, which is a list of numbers separated by whitespaces and enclosed by { and } . The returned value is then a set of rational numbers (in the GAP sense).</p>
<p><a id="X7E7886D68356F592" name="X7E7886D68356F592"></a></p>
<h5>4.2-8 ConvertPolymakeListOfSetsToGAP</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">an style='color: green'>8227; ConvertPolymakeListOfSetsToGAP</code>( <var class="Arg">list</var> )</td><td class="tdright">( method )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">an style='color: green'>8227; ConvertPolymakeListOfSetsToGAPPlusOne</code>( <var class="Arg">list</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Let <var class="Arg">list</var> be a list containing several strings representing sets. Then each of these strings is converted to a set of rational numbers and the returned value is the list of all those sets. The "PlusOne" version adds 1 to every entry.</p>
<p><a id="X7EBECAA07F8B58D8" name="X7EBECAA07F8B58D8"></a></p>
<h5>4.2-9 ConvertPolymakeGraphToGAP</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">an style='color: green'>8227; ConvertPolymakeGraphToGAP</code>( <var class="Arg">list</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Let <var class="Arg">list</var> be a list of strings representing sets (that is, a list of integers enclosed by { and }). Then a record is returned containing two sets named <code class="code">.vertices</code> and <code class="code">.edges</code>.</p>
<div class="chlinkprevnextbot"> <a href="chap0.html">[Top of Book]</a> <a href="chap0.html#contents">[Contents]</a> <a href="chap3.html">[Previous Chapter]</a> <a href="chapBib.html">[Next Chapter]</a> </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="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>
¤ Dauer der Verarbeitung: 0.7 Sekunden
¤
*© Formatika GbR, Deutschland
|
|