Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 5e1854624d3bc613bdd0dd13d1ef9ac7 > files > 2722

gap-system-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 (polymaking) - Chapter 2: Polymake interaction</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="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="chap1.html">Previous Chapter</a>&nbsp;  &nbsp;<a href="chap3.html">Next Chapter</a>&nbsp;  </div>

<p><a id="X86C82DCF81362F41" name="X86C82DCF81362F41"></a></p>
<div class="ChapSects"><a href="chap2.html#X86C82DCF81362F41">2. <span class="Heading">Polymake interaction</span></a>
<div class="ContSect"><span class="nocss">&nbsp;</span><a href="chap2.html#X83D426D5855D1FD6">2.1 <span class="Heading">Creating Polymake Objects</span></a>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X7C87B1807E036A85">2.1-1 CreateEmptyFile</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X8625E7E2845F1634">2.1-2 CreatePolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X8135E88E87DD1551">2.1-3 CheckAppVerTypList</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X7801F05A81E23EED">2.1-4 CreatePolymakeObjectFromFile</a></span>
</div>
<div class="ContSect"><span class="nocss">&nbsp;</span><a href="chap2.html#X7D9EBB0383B9BD1C">2.2 <span class="Heading">Accessing Properties of Polymake Objects</span></a>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X86D967C684B27108">2.2-1 DirectoryOfPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X87470AB079A2F550">2.2-2 FilenameOfPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X809D309F7D31DD2C">2.2-3 FullFilenameOfPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X850B38F27F1BF7E8">2.2-4 NamesKnownPropertiesOfPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X7D79C5F1817041C5">2.2-5 KnownPropertiesOfPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X7E538D1B7898C8E6">2.2-6 PropertyOfPolymakeObject</a></span>
</div>
<div class="ContSect"><span class="nocss">&nbsp;</span><a href="chap2.html#X7CEF475187927AEA">2.3 <span class="Heading">Example: Creating and Accessing Polymake Objects</span></a>
</div>
<div class="ContSect"><span class="nocss">&nbsp;</span><a href="chap2.html#X87BEE1B37D9F1F5E">2.4 <span class="Heading">Writing to Polymake Objects</span></a>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X785DCA4487F168F8">2.4-1 AppendToPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X7F5326338033B57C">2.4-2 AppendPointlistToPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X7E150BA67CEBC00E">2.4-3 AppendVertexlistToPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X7EBE5FB284FBFFE6">2.4-4 AppendInequalitiesToPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X83DC7FC280731B04">2.4-5 ConvertMatrixToPolymakeString</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X804AAE4882743E91">2.4-6 ClearPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X840C02CD815FF766">2.4-7 WriteKnownPropertyToPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X7A3FF18C7FD1A626">2.4-8 UnbindKnownPropertyOfPolymakeObject</a></span>
</div>
<div class="ContSect"><span class="nocss">&nbsp;</span><a href="chap2.html#X8468E0E381642B14">2.5 <span class="Heading">Calling Polymake and converting its output</span></a>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X7DBA99E87EC51D53">2.5-1 Polymake</a></span>
</div>
<div class="ContSect"><span class="nocss">&nbsp;</span><a href="chap2.html#X7B5623E3821CC0D0">2.6 <span class="Heading">An Example</span></a>
</div>
<div class="ContSect"><span class="nocss">&nbsp;</span><a href="chap2.html#X8721882779D8EA95">2.7 <span class="Heading">Calling Clients</span></a>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X7B7BFA407F54D37E">2.7-1 PolymakeClient</a></span>
</div>
</div>

<h3>2. <span class="Heading">Polymake interaction</span></h3>

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

<h4>2.1 <span class="Heading">Creating Polymake Objects</span></h4>

<p>The interaction with the polymake program is done via files. So a <code class="keyw">PolymakeObject</code> is mainly a pointer to a file and a list of known properties of the object. These properties need not be stored in the file. Whenever polymake is called, the returned value is read from standard output and stored in the <code class="keyw">PolymakeObject</code> corresponding to the file for which polymake is called.</p>

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

<h5>2.1-1 CreateEmptyFile</h5>

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

<p>Creates an empty file with name <var class="Arg">filename</var>. Note that <var class="Arg">filename</var> has to include the full path and the directory for the file must exist.</p>

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

<h5>2.1-2 CreatePolymakeObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; CreatePolymakeObject</code>( <var class="Arg"></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">&gt; CreatePolymakeObject</code>( <var class="Arg">appvertyp</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">&gt; CreatePolymakeObject</code>( <var class="Arg">dir</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">&gt; CreatePolymakeObject</code>( <var class="Arg">dir, appvertyp</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">&gt; CreatePolymakeObject</code>( <var class="Arg">prefix, dir</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">&gt; CreatePolymakeObject</code>( <var class="Arg">prefix, dir, appvertyp</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p><b>Returns: </b><code class="keyw">PolymakeObject</code></p>

<p>If called without arguments, this method generates an empty file in the directory defined by <code class="func">POLYMAKE_DATA_DIR</code> (<a href="chap3.html#X7C07B16B873BA46D"><b>3.2-2</b></a>). If a directory <var class="Arg">dir</var> is given (this directory must exist), an empty file is generated in this directory. If <var class="Arg">prefix</var> is not given, the file is called <code class="file">polyN</code> where <code class="keyw">N</code> is the current runtime. If a file of this name already exists, a number is appended separated by a dot (example: "poly1340" and "poly1340.1"). If <var class="Arg">prefix</var> is given, the filename starts with this prefix. Optionally, the file can be generated with a header specifying application, version and type of the object. This is done by passing the triple of strings <var class="Arg">appvertyp</var> to <code class="func">CreatePolymakeObject</code>. A valid triple is <code class="code">["polytope","2.3","RationalPolytope"]</code>. Validity is checked by <code class="func">CheckAppVerTypList</code> (<a href="chap2.html#X8135E88E87DD1551"><b>2.1-3</b></a>).</p>

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

<h5>2.1-3 CheckAppVerTypList</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; CheckAppVerTypList</code>( <var class="Arg">appvertyp</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p><b>Returns: </b><code class="keyw">bool</code></p>

<p>Checks if the triple <var class="Arg">arppvertyp</var> of strings specifies an application and type of polymake version 2.3. More specifically, the first entry has to be an application from <code class="code">["polytope","surface","topaz"]</code> and the third entry has to be a type corresponding to the application given in the first entry. The second entry is not checked.<br /></p>

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

<h5>2.1-4 CreatePolymakeObjectFromFile</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; CreatePolymakeObjectFromFile</code>( <var class="Arg">filename</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">&gt; CreatePolymakeObjectFromFile</code>( <var class="Arg">dir, filename</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p><b>Returns: </b><code class="keyw">PolymakeObject</code></p>

<p>This method generates a <code class="keyw">PolymakeObject</code> corresponding to the file <var class="Arg">filename</var> in the directory <var class="Arg">dir</var>. If <var class="Arg">dir</var> is not given, the <code class="keyw">POLYMAKE_DATA_DIR</code> is used.If no file with name <var class="Arg">filename</var> exists in <var class="Arg">dir</var> (or <code class="keyw">POLYMAKE_DATA_DIR</code>, respectively), an empty file is created. Note that the contents of the file do not matter for the generation of the object. In particular, the object does not know any of the properties that might be encoded in the file. The only way to transfer information from files to <code class="keyw">PolymakeObject</code>s is via <code class="func">Polymake</code> (<a href="chap2.html#X7DBA99E87EC51D53"><b>2.5-1</b></a>).</p>

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

<h4>2.2 <span class="Heading">Accessing Properties of Polymake Objects</span></h4>

<p>A <code class="keyw">PolymakeObject</code> contains information about the directory of its file, the name of its file and about properties calculated by calling <code class="func">Polymake</code> (<a href="chap2.html#X7DBA99E87EC51D53"><b>2.5-1</b></a>). The properties returned by the <code class="keyw">polymake</code> program are stored under the name <code class="keyw">polymake</code> assigns to them (that is, the name of the data block in the corresponding file). The following methods can be used to access the information stored in a <code class="keyw">PolymakeObject</code>. But be careful! All functions return the actual object. No copies are made. So if you change one of the returned objects, you change the <code class="keyw">PolymakeObject</code> itself.</p>

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

<h5>2.2-1 DirectoryOfPolymakeObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; DirectoryOfPolymakeObject</code>( <var class="Arg">poly</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p><b>Returns: </b>Directory</p>

<p>Returns the directory of the file associated with <var class="Arg">poly</var>.</p>

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

<h5>2.2-2 FilenameOfPolymakeObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; FilenameOfPolymakeObject</code>( <var class="Arg">poly</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p><b>Returns: </b>String</p>

<p>Returns the name of the file associated with <var class="Arg">poly</var>. This does only mean the name of the <em>file</em>, not the full path. For the full path and file name see <code class="func">FullFilenameOfPolymakeObject</code> (<a href="chap2.html#X809D309F7D31DD2C"><b>2.2-3</b></a>)</p>

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

<h5>2.2-3 FullFilenameOfPolymakeObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; FullFilenameOfPolymakeObject</code>( <var class="Arg">poly</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p><b>Returns: </b>String</p>

<p>Returns the file associated with the <code class="keyw">PolymakeObject</code> <var class="Arg">poly</var> with its complete path.</p>

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

<h5>2.2-4 NamesKnownPropertiesOfPolymakeObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; NamesKnownPropertiesOfPolymakeObject</code>( <var class="Arg">poly</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p><b>Returns: </b>List of Strings</p>

<p>Returns a list of the names of all known properties. This does only include the properties returned by <code class="func">Polymake</code> (<a href="chap2.html#X7DBA99E87EC51D53"><b>2.5-1</b></a>), <code class="code">"dir"</code> and <code class="code">"filename"</code> are not included. If no properties are known, <code class="keyw">fail</code> is returned.</p>

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

<h5>2.2-5 KnownPropertiesOfPolymakeObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; KnownPropertiesOfPolymakeObject</code>( <var class="Arg">poly</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p><b>Returns: </b>Record</p>

<p>Returns the record of all known properties. If no properties are known, <code class="keyw">fail</code> is returned.</p>

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

<h5>2.2-6 PropertyOfPolymakeObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; PropertyOfPolymakeObject</code>( <var class="Arg">poly, name</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns the value of the property <var class="Arg">name</var> if it is known. If the value is not known, <code class="keyw">fail</code> is returned. <var class="Arg">name</var> must be a <code class="keyw">String</code>.</p>

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

<h4>2.3 <span class="Heading">Example: Creating and Accessing Polymake Objects</span></h4>

<p>Suppose the file <code class="file">/tmp/threecube.poly</code> contains the three dimensional cube in polymake form (as generated by the command line <code class="code">cube /tmp/threecube.poly 3 1</code> ). Now generate a <code class="keyw">PolymakeObject</code> from this file and call <code class="func">Polymake</code> (<a href="chap2.html#X7DBA99E87EC51D53"><b>2.5-1</b></a>) to make the vertices of the cube known to the object.</p>


<table class="example">
<tr><td><pre>

### suppose we have a polymake file /tmp/threecube.poly
### containing a cube in three dimensions
gap&gt; cube:=CreatePolymakeObjectFromFile(Directory("/tmp"),"threecube.poly");
&lt;polymake object. No properties known&gt;
gap&gt; FilenameOfPolymakeObject(cube);
"threecube.poly"
gap&gt; FullFilenameOfPolymakeObject(cube);
"/tmp/threecube.poly"
   #nothing is known about the cube:
gap&gt; NamesKnownPropertiesOfPolymakeObject(cube);  
fail
gap&gt; Polymake(cube,"VERTICES");
[ [ -1, -1, -1 ], [ 1, -1, -1 ], [ -1, 1, -1 ], [ 1, 1, -1 ], [ -1, -1, 1 ], 
  [ 1, -1, 1 ], [ -1, 1, 1 ], [ 1, 1, 1 ] ]  
   # Now &lt;cube&gt; knows its vertices:
gap&gt; Print(cube);
&lt;polymake object threecube.poly. Properties known: [ "VERTICES" ]&gt;
gap&gt; PropertyOfPolymakeObject(cube,"VERTICES");
[ [ -1, -1, -1 ], [ 1, -1, -1 ], [ -1, 1, -1 ], [ 1, 1, -1 ], [ -1, -1, 1 ],
  [ 1, -1, 1 ], [ -1, 1, 1 ], [ 1, 1, 1 ] ]
gap&gt; KnownPropertiesOfPolymakeObject(cube);
rec(
  VERTICES := [ [ -1, -1, -1 ], [ 1, -1, -1 ], [ -1, 1, -1 ], [ 1, 1, -1 ],
      [ -1, -1, 1 ], [ 1, -1, 1 ], [ -1, 1, 1 ], [ 1, 1, 1 ] ] )

</pre></td></tr></table>

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

<h4>2.4 <span class="Heading">Writing to Polymake Objects</span></h4>

<p>To transfer data from <strong class="pkg">GAP</strong> to polymake, the following methods can be used. But bear in mind that none of these functions test if the resulting polymake file is still consistent.</p>

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

<h5>2.4-1 AppendToPolymakeObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; AppendToPolymakeObject</code>( <var class="Arg">poly, string</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p><b>Returns: </b>nothing</p>

<p>This appends the string <var class="Arg">string</var> to the file associated to the <code class="keyw">PolymakeObject</code> <var class="Arg">poly</var>. It is not tested if the string is syntactically correct as a part of a polymake file. It is also not tested if the string is compatible with the data already contained in the file.</p>

<p>INEQUALITIES, POINTS and VERTICES can be appended to a polymake object using the following functions:</p>

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

<h5>2.4-2 AppendPointlistToPolymakeObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; AppendPointlistToPolymakeObject</code>( <var class="Arg">poly, pointlist</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p><b>Returns: </b>nothing</p>

<p>Takes a list <var class="Arg">pointlist</var> of vectors and converts it into a string which represents a polymake block labeled "POINTS". This string is then added to the file associated with <var class="Arg">poly</var>. The "POINTS" block of the file associated with <var class="Arg">poly</var> then contains points with leading ones, as polymake uses affine notation.</p>

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

<h5>2.4-3 AppendVertexlistToPolymakeObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; AppendVertexlistToPolymakeObject</code>( <var class="Arg">poly, pointlist</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p><b>Returns: </b>nothing</p>

<p>Does the same as <code class="code">AppendPointlistToPolymakeObject</code>, but with "VERTICES" instead of "POINTS".</p>

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

<h5>2.4-4 AppendInequalitiesToPolymakeObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; AppendInequalitiesToPolymakeObject</code>( <var class="Arg">poly, ineqlist</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p><b>Returns: </b>nothing</p>

<p>Just appends the inequalities given in <var class="Arg">ineqlist</var> to the polymake object <var class="Arg"> poly</var> (with caption "INEQUALITIES"). Note that this does not check if an "INEQUALITIES" section does already exist in the file associated with <var class="Arg">poly</var>.</p>

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

<h5>2.4-5 ConvertMatrixToPolymakeString</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; ConvertMatrixToPolymakeString</code>( <var class="Arg">name, matrix</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p><b>Returns: </b>String</p>

<p>This function takes a matrix <var class="Arg">matrix</var> and converts it to a string. This string can then be appended to a polymake file via <code class="func">AppendToPolymakeObject</code> (<a href="chap2.html#X785DCA4487F168F8"><b>2.4-1</b></a>) to form a block of data labeled <var class="Arg">name</var>. This may be used to write blocks like INEQUALITIES or FACETS.</p>

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

<h5>2.4-6 ClearPolymakeObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; ClearPolymakeObject</code>( <var class="Arg">poly</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">&gt; ClearPolymakeObject</code>( <var class="Arg">poly, appvertyp</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p><b>Returns: </b>nothing</p>

<p>Deletes all known properties of the <code class="keyw">PolymakeObject</code> <var class="Arg">poly</var> and replaces its file with an empty one. <br /> If the triple of strings <var class="Arg">appvertyp</var> specifying application, version and type (see <code class="func">CheckAppVerTypList</code> (<a href="chap2.html#X8135E88E87DD1551"><b>2.1-3</b></a>)) is given, the file is replaced with a file that contains only a header specifying application, version and type of the polymake object.</p>

<p>There are also methods to manipulate the known values without touching the file of the <code class="keyw">PolymakeObject</code>:</p>

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

<h5>2.4-7 WriteKnownPropertyToPolymakeObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; WriteKnownPropertyToPolymakeObject</code>( <var class="Arg">poly, name, data</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Takes the object <var class="Arg">data</var> and writes it to the known properties section of the <code class="keyw">PolymakeObject</code> <var class="Arg">poly</var>. The string <var class="Arg">name</var> is used as the name of the property. If a property with that name already exists, it is overwritten. Again, there is no check if <var class="Arg">data</var> is consistent, correct or meaningful.</p>

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

<h5>2.4-8 UnbindKnownPropertyOfPolymakeObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; UnbindKnownPropertyOfPolymakeObject</code>( <var class="Arg">poly, name</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>If the <code class="keyw">PolymakeObject</code> <var class="Arg">poly</var> has a property with name <var class="Arg">name</var>, that property is unbound. If there is no such property, <code class="keyw">fail</code> is returned.</p>

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

<h4>2.5 <span class="Heading">Calling Polymake and converting its output</span></h4>

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

<h5>2.5-1 Polymake</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; Polymake</code>( <var class="Arg">poly, option[, :[, PolymakeNolookup]]</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>This method calls the polymake program (see <code class="func">POLYMAKE_COMMAND</code> (<a href="chap3.html#X7B35A5217C8C7B04"><b>3.2-1</b></a>)) with the option <var class="Arg">option</var>. You may use several keywords such as <code class="code">"DIM VERTICES"</code> as an option. The returned value is cut into blocks starting with keywords (which are taken from output and not looked up in <var class="Arg">option</var>). Each block is then interpreted and translated into <strong class="pkg">GAP</strong> readable form. This translation is done using the functions given in <code class="func">ObjectConverters</code> (<a href="chap4.html#X83199F737F4BE4FD"><b>4.1-4</b></a>). The first line of each block of polymake output is taken as a keyword and the according entry in <code class="func">ObjectConverters</code> (<a href="chap4.html#X83199F737F4BE4FD"><b>4.1-4</b></a>) is called to convert the block into <strong class="pkg">GAP</strong> readable form. If no conversion function is known, an info string is printed and <code class="keyw">fail</code> is returned. If only one keyword has been given as <var class="Arg">option</var>, <code class="code">Polymake</code> returns the result of the conversion operation. If more than one keyword has been given or the output consists of more than one block, <code class="code">Polymake</code> returns <code class="keyw">fail</code>. In any case, the calculated values for each block are stored as known properties of the <code class="keyw">PolymakeObject</code> <var class="Arg">poly</var> as long as they are not <code class="keyw">fail</code>. If <code class="keyw">Polymake</code> is called with an option that corresponds to a name of a known property of <var class="Arg">poly</var>, the known property is returned. In this case, there is no call of the external program. (see below for suppression of this feature).</p>

<p>Note that the command <code class="keyw">Polymake</code> returns <code class="keyw">fail</code> if nothing is returned by the program polymake or more than one block of data is returned. For example, the returned value of <code class="code">Polymake(poly,"VISUAL")</code> is always <code class="keyw">fail</code>. Likewise, <code class="code">Polymake(poly,"POINTS VERTICES")</code> will return <code class="keyw">fail</code> (but may add new known properties to <var class="Arg">poly</var>). For a description of the conversion functions, see chapter <a href="chap4.html#X7D23E80E841CDD67"><b>4.</b></a>.</p>

<p>If the option <var class="Arg">PolymakeNolookup</var> is set to anything else than false, the polymake program is called even if <var class="Arg">poly</var> already has a known property with name <var class="Arg">option</var>.</p>

<p>Note that whenever <code class="func">Polymake</code> returns <code class="keyw">fail</code>, a description of the problem is stored in <code class="func">POLYMAKE_LAST_FAIL_REASON</code> (<a href="chap3.html#X79E1C63D8516D334"><b>3.1-2</b></a>). If you call <code class="func">Polymake</code> with more than one keyword, <code class="func">POLYMAKE_LAST_FAIL_REASON</code> (<a href="chap3.html#X79E1C63D8516D334"><b>3.1-2</b></a>) is changed before polymake is called. So any further reason to return <code class="keyw">fail</code> will overwrite it.</p>

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

<h4>2.6 <span class="Heading">An Example</span></h4>

<p>Let's generate a three dimensional permutahedron.</p>


<table class="example">
<tr><td><pre>
    
    gap&gt; S:=SymmetricGroup(3);
    Sym( [ 1 .. 3 ] )
    gap&gt; v:=[1,2,3];
    [ 1, 2, 3 ]
    gap&gt; points:=Orbit(S,v,Permuted);;
    gap&gt; permutahedron:=CreatePolymakeObject();
    &lt;polymake object. No properties known&gt;
    gap&gt; AppendPointlistToPolymakeObject(permutahedron,points);
    gap&gt; Polymake(permutahedron,"VOLUME");
    3
    gap&gt; Polymake(permutahedron,"N_VERTICES");
    6
          #Now &lt;permutahedron&gt; knows its number of vertices, but not the vertices:
    gap&gt; PropertyOfPolymakeObject(permutahedron,"VERTICES");
    fail
    gap&gt; NamesKnownPropertiesOfPolymakeObject(permutahedron);
    [ "VOLUME", "N_VERTICES" ]
        #Let's look at the object!
    gap&gt; Polymake(permutahedron,"VISUAL");
    #I  There was no or wrong polymake output
    fail
    gap&gt; Polymake(permutahedron,"DIM");
    2
    
    </pre></td></tr></table>

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

<h4>2.7 <span class="Heading">Calling Clients</span></h4>

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

<h5>2.7-1 PolymakeClient</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&gt; PolymakeClient</code>( <var class="Arg">clientname[, outobject][, inobjects][, options]</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">&gt; PolymakeClientNC</code>( <var class="Arg">clientname, outobject, inobjects, options</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p><b>Returns: </b>PolymakeObject</p>

<p>Any client program that has a command line syntax like <br /> <code class="code">clientname outfile infile1 infile2... -option1 -option2...</code> <br /> can be called using <code class="keyw">PolymakeClient</code>. Any output of the client to the terminal is ignored (but a warning is printed if this happens). <br /> <var class="Arg">clientname</var> must be given as a string without path. Polymaking looks for clients in the directories listed in <code class="func">POLYMAKE_CLIENT_PATHS</code> (<a href="chap3.html#X875BDBAE8075192A"><b>3.2-3</b></a>). <br /> The client program is called and passed the file corresponding to the PolymakeObject <var class="Arg">outobject</var>, the files of the PolymakeObjects in the list <var class="Arg">inobjects</var> and finally the string <var class="Arg">options</var>. If no PolymakeObject <var class="Arg">outobject</var> is given, a new object is created. <code class="keyw">PolymakeClient</code> returns the PolymakeObject <var class="Arg">outobject</var> if it was given, otherwise a new PolymakeObject is returned. <br /> <code class="keyw">PolymakeClientNC</code> does not perform any checks on the input objects. <br /> <em>Important:</em> <code class="keyw">PolymakeClient</code> does not change the known properties of <var class="Arg">outfile</var>. This can lead to inconsistencies if you "recycle" files. So if you know that a client will overwrite the output file, consider using <code class="func">ClearPolymakeObject</code> (<a href="chap2.html#X804AAE4882743E91"><b>2.4-6</b></a>) on the output PolymakeObject before calling the client.</p>


<table class="example">
<tr><td><pre>

gap&gt; rand:=PolymakeClient("rand_sphere","3 15");
&lt;polymake object. No properties known&gt;
gap&gt; Polymake(rand,"N_VERTICES");
15
gap&gt; cube:=PolymakeClient("cube","3");
gap&gt; Polymake(cube,"N_VERTICES");
8
gap&gt; PolymakeClient("pyramid",rand,[cube]);
&lt;polymake object&gt;
gap&gt; IsIdenticalObj(last,rand);
true
gap&gt; ## the file of &lt;rand&gt; has changed, but polymaking doesn't know about it:
gap&gt; Polymake(rand,"N_VERTICES");
15
gap&gt; Polymake(rand,"N_VERTICES":PolymakeNolookup);
9

</pre></td></tr></table>


<div class="chlinkprevnextbot">&nbsp;<a href="chap0.html">Top of Book</a>&nbsp;  &nbsp;<a href="chap1.html">Previous Chapter</a>&nbsp;  &nbsp;<a href="chap3.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="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>