1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
|
<?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://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<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" />
<script src="manual.js" type="text/javascript"></script>
<script type="text/javascript">overwriteStyle();</script>
</head>
<body class="chap2" 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="chap1_mj.html">[Previous Chapter]</a> <a href="chap3_mj.html">[Next Chapter]</a> </div>
<p id="mathjaxlink" class="pcenter"><a href="chap2.html">[MathJax off]</a></p>
<p><a id="X86C82DCF81362F41" name="X86C82DCF81362F41"></a></p>
<div class="ChapSects"><a href="chap2_mj.html#X86C82DCF81362F41">2 <span class="Heading">Polymake interaction</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2_mj.html#X83D426D5855D1FD6">2.1 <span class="Heading">Creating Polymake Objects</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X7C87B1807E036A85">2.1-1 CreateEmptyFile</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X8625E7E2845F1634">2.1-2 CreatePolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X8135E88E87DD1551">2.1-3 CheckAppVerTypList</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X7801F05A81E23EED">2.1-4 CreatePolymakeObjectFromFile</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2_mj.html#X7D9EBB0383B9BD1C">2.2 <span class="Heading">Accessing Properties of Polymake Objects</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X86D967C684B27108">2.2-1 DirectoryOfPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X87470AB079A2F550">2.2-2 FilenameOfPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X809D309F7D31DD2C">2.2-3 FullFilenameOfPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X850B38F27F1BF7E8">2.2-4 NamesKnownPropertiesOfPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X7D79C5F1817041C5">2.2-5 KnownPropertiesOfPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X7E538D1B7898C8E6">2.2-6 PropertyOfPolymakeObject</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2_mj.html#X7CEF475187927AEA">2.3 <span class="Heading">Example: Creating and Accessing Polymake Objects</span></a>
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2_mj.html#X87BEE1B37D9F1F5E">2.4 <span class="Heading">Writing to Polymake Objects</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X785DCA4487F168F8">2.4-1 AppendToPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X7F5326338033B57C">2.4-2 AppendPointlistToPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X7E150BA67CEBC00E">2.4-3 AppendVertexlistToPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X7EBE5FB284FBFFE6">2.4-4 AppendInequalitiesToPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X83DC7FC280731B04">2.4-5 ConvertMatrixToPolymakeString</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X804AAE4882743E91">2.4-6 ClearPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X840C02CD815FF766">2.4-7 WriteKnownPropertyToPolymakeObject</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X7A3FF18C7FD1A626">2.4-8 UnbindKnownPropertyOfPolymakeObject</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2_mj.html#X8468E0E381642B14">2.5 <span class="Heading">Calling Polymake and converting its output</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2_mj.html#X7DBA99E87EC51D53">2.5-1 Polymake</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2_mj.html#X7B5623E3821CC0D0">2.6 <span class="Heading">An Example</span></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. 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. The files for polymake are written in the old (non-xml) format. The first run of polymake converts them into the new (xml) format. This means that changes to the file by means of the methods outlined below after the first run of polymake will probably lead to corrupted files.</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">‣ CreateEmptyFile</code>( <var class="Arg">filename</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: 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">‣ CreatePolymakeObject</code>( )</td><td class="tdright">( method )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ 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">‣ 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">‣ CreatePolymakeObject</code>( <var class="Arg">dir</var>, <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">‣ CreatePolymakeObject</code>( <var class="Arg">prefix</var>, <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">‣ CreatePolymakeObject</code>( <var class="Arg">prefix</var>, <var class="Arg">dir</var>, <var class="Arg">appvertyp</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: <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_mj.html#X7C07B16B873BA46D"><span class="RefLink">3.2-2</span></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_mj.html#X8135E88E87DD1551"><span class="RefLink">2.1-3</span></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">‣ CheckAppVerTypList</code>( <var class="Arg">appvertyp</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: <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">‣ 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">‣ CreatePolymakeObjectFromFile</code>( <var class="Arg">dir</var>, <var class="Arg">filename</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: <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_mj.html#X7DBA99E87EC51D53"><span class="RefLink">2.5-1</span></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_mj.html#X7DBA99E87EC51D53"><span class="RefLink">2.5-1</span></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">‣ DirectoryOfPolymakeObject</code>( <var class="Arg">poly</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: 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">‣ FilenameOfPolymakeObject</code>( <var class="Arg">poly</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: 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_mj.html#X809D309F7D31DD2C"><span class="RefLink">2.2-3</span></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">‣ FullFilenameOfPolymakeObject</code>( <var class="Arg">poly</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: 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">‣ NamesKnownPropertiesOfPolymakeObject</code>( <var class="Arg">poly</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: 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_mj.html#X7DBA99E87EC51D53"><span class="RefLink">2.5-1</span></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">‣ KnownPropertiesOfPolymakeObject</code>( <var class="Arg">poly</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: 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">‣ PropertyOfPolymakeObject</code>( <var class="Arg">poly</var>, <var class="Arg">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. Now generate a <code class="keyw">PolymakeObject</code> from this file and call <code class="func">Polymake</code> (<a href="chap2_mj.html#X7DBA99E87EC51D53"><span class="RefLink">2.5-1</span></a>) to make the vertices of the cube known to the object.</p>
<div class="example"><pre>
### suppose we have a polymake file /tmp/threecube.poly
### containing a cube in three dimensions
<span class="GAPprompt">gap></span> <span class="GAPinput">cube:=CreatePolymakeObjectFromFile(Directory("/tmp"),"threecube.poly");</span>
<polymake object. No properties known>
<span class="GAPprompt">gap></span> <span class="GAPinput">FilenameOfPolymakeObject(cube);</span>
"threecube.poly"
<span class="GAPprompt">gap></span> <span class="GAPinput">FullFilenameOfPolymakeObject(cube);</span>
"/tmp/threecube.poly"
#nothing is known about the cube:
<span class="GAPprompt">gap></span> <span class="GAPinput">NamesKnownPropertiesOfPolymakeObject(cube); </span>
fail
<span class="GAPprompt">gap></span> <span class="GAPinput">Polymake(cube,"VERTICES");</span>
[ [ -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 <cube> knows its vertices:
<span class="GAPprompt">gap></span> <span class="GAPinput">Print(cube);</span>
<polymake object threecube.poly. Properties known: [ "VERTICES" ]>
<span class="GAPprompt">gap></span> <span class="GAPinput">PropertyOfPolymakeObject(cube,"VERTICES");</span>
[ [ -1, -1, -1 ], [ 1, -1, -1 ], [ -1, 1, -1 ], [ 1, 1, -1 ], [ -1, -1, 1 ],
[ 1, -1, 1 ], [ -1, 1, 1 ], [ 1, 1, 1 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">KnownPropertiesOfPolymakeObject(cube);</span>
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></div>
<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">‣ AppendToPolymakeObject</code>( <var class="Arg">poly</var>, <var class="Arg">string</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: 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">‣ AppendPointlistToPolymakeObject</code>( <var class="Arg">poly</var>, <var class="Arg">pointlist</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: 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">‣ AppendVertexlistToPolymakeObject</code>( <var class="Arg">poly</var>, <var class="Arg">pointlist</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: 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">‣ AppendInequalitiesToPolymakeObject</code>( <var class="Arg">poly</var>, <var class="Arg">ineqlist</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: 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">‣ ConvertMatrixToPolymakeString</code>( <var class="Arg">name</var>, <var class="Arg">matrix</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: 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_mj.html#X785DCA4487F168F8"><span class="RefLink">2.4-1</span></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">‣ 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">‣ ClearPolymakeObject</code>( <var class="Arg">poly</var>, <var class="Arg">appvertyp</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: 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_mj.html#X8135E88E87DD1551"><span class="RefLink">2.1-3</span></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">‣ WriteKnownPropertyToPolymakeObject</code>( <var class="Arg">poly</var>, <var class="Arg">name</var>, <var class="Arg">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">‣ UnbindKnownPropertyOfPolymakeObject</code>( <var class="Arg">poly</var>, <var class="Arg">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">‣ Polymake</code>( <var class="Arg">poly</var>, <var class="Arg">option:</var> <var class="Arg">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_mj.html#X7B35A5217C8C7B04"><span class="RefLink">3.2-1</span></a>)) with the option <var class="Arg">option</var>. You may use several keywords such as <code class="code">"FACETS 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_mj.html#X83199F737F4BE4FD"><span class="RefLink">4.1-4</span></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_mj.html#X83199F737F4BE4FD"><span class="RefLink">4.1-4</span></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_mj.html#X7D23E80E841CDD67"><span class="RefLink">4</span></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_mj.html#X79E1C63D8516D334"><span class="RefLink">3.1-2</span></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_mj.html#X79E1C63D8516D334"><span class="RefLink">3.1-2</span></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>
<div class="example"><pre>
gap> S:=SymmetricGroup(3);
Sym( [ 1 .. 3 ] )
gap> v:=[1,2,3];
[ 1, 2, 3 ]
gap> points:=Orbit(S,v,Permuted);;
gap> permutahedron:=CreatePolymakeObject();
<polymake object. No properties known>
gap> AppendPointlistToPolymakeObject(permutahedron,points);
gap> Polymake(permutahedron,"VOLUME");
3
gap> Polymake(permutahedron,"N_VERTICES");
6
#Now <permutahedron> knows its number of vertices, but not the vertices:
gap> PropertyOfPolymakeObject(permutahedron,"VERTICES");
fail
gap> NamesKnownPropertiesOfPolymakeObject(permutahedron);
[ "VOLUME", "N_VERTICES" ]
#Let's look at the object!
gap> Polymake(permutahedron,"VISUAL");
#I There was no or wrong polymake output
fail
gap> Polymake(permutahedron,"DIM");
2
</pre></div>
<div class="chlinkprevnextbot"> <a href="chap0_mj.html">[Top of Book]</a> <a href="chap0_mj.html#contents">[Contents]</a> <a href="chap1_mj.html">[Previous Chapter]</a> <a href="chap3_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="http://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc">GAPDoc2HTML</a></p>
</body>
</html>
|