<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>
<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. GAP enumerates lists starting at 1. So the conversion process adds 1 to the numbers corresponding to vertices in facet lists, for example.
<p>The conversion process is done by the following methods:</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ 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_mj.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_mj.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>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ 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>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ 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_mj.html#X7FF4170183C83CC1"><span class="RefLink">4.2</span></a>.</p>
<p>The following functions are used for the functions in <code class="func">ObjectConverters</code> (<a href="chap4_mj.html#X83199F737F4BE4FD"><span class="RefLink">4.1-4</span></a>).</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ 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>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ 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_mj.html#X7FC98443862DB83F"><span class="RefLink">4.2-1</span></a>).</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ 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">‣ 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_mj.html#X817C6B4180BF6365"><span class="RefLink">4.2-4</span></a>) or <code class="func">ConvertPolymakeListOfSetsToGAP</code> (<a href="chap4_mj.html#X7E7886D68356F592"><span class="RefLink">4.2-8</span></a>). The "PlusOne" version calls <code class="func">ConvertPolymakeListOfSetsToGAPPlusOne</code> (<a href="chap4_mj.html#X7E7886D68356F592"><span class="RefLink">4.2-8</span></a>) if <var class="Arg">list</var> represents a list of sets.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ 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">‣ 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>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ 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>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ 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>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ 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">‣ 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>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ 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>
¤ 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.53Bemerkung:
Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können
¤
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.