Calling Polymake and converting its output

This method calls the polymake program (see ) with the option option. You may use several keywords such as "DIM VERTICES" as an option. The returned value is cut into blocks starting with keywords (which are taken from output and not looked up in option). Each block is then interpreted and translated into &GAP; readable form. This translation is done using the functions given in .

The first line of each block of polymake output is taken as a keyword and the according entry in is called to convert the block into &GAP; readable form. If no conversion function is known, an info string is printed and fail is returned.

If only one keyword has been given as option, Polymake returns the result of the conversion operation. If more than one keyword has been given or the output consists of more than one block, Polymake returns fail.

In any case, the calculated values for each block are stored as known properties of the PolymakeObject poly as long as they are not fail.

If Polymake is called with an option that corresponds to a name of a known property of poly, the known property is returned. In this case, there is no call of the external program. (see below for suppression of this feature).

Note that the command Polymake returns fail if nothing is returned by the program polymake or more than one block of data is returned. For example, the returned value of Polymake(poly,"VISUAL") is always fail. Likewise, Polymake(poly,"POINTS VERTICES") will return fail (but may add new known properties to poly).

For a description of the conversion functions, see chapter .

If the option PolymakeNolookup is set to anything else than false, the polymake program is called even if poly already has a known property with name option.

Note that whenever returns fail, a description of the problem is stored in . If you call with more than one keyword, is changed before polymake is called. So any further reason to return fail will overwrite it.

An Example

Let's generate a three dimensional permutahedron.

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
Calling Clients
PolymakeObject
Any client program that has a command line syntax like
clientname outfile infile1 infile2... -option1 -option2...
can be called using PolymakeClient. Any output of the client to the terminal is ignored (but a warning is printed if this happens).
clientname must be given as a string without path. Polymaking looks for clients in the directories listed in .
The client program is called and passed the file corresponding to the PolymakeObject outobject, the files of the PolymakeObjects in the list inobjects and finally the string options. If no PolymakeObject outobject is given, a new object is created. PolymakeClient returns the PolymakeObject outobject if it was given, otherwise a new PolymakeObject is returned.
PolymakeClientNC
does not perform any checks on the input objects.
Important:
PolymakeClient
does not change the known properties of outfile. This can lead to inconsistencies if you "recycle" files. So if you know that a client will overwrite the output file, consider using on the output PolymakeObject before calling the client.
gap> rand:=PolymakeClient("rand_sphere","3 15"); <polymake object. No properties known> gap> Polymake(rand,"N_VERTICES"); 15 gap> cube:=PolymakeClient("cube","3"); gap> Polymake(cube,"N_VERTICES"); 8 gap> PolymakeClient("pyramid",rand,[cube]); <polymake object> gap> IsIdenticalObj(last,rand); true gap> ## the file of <rand> has changed, but polymaking doesn't know about it: gap> Polymake(rand,"N_VERTICES"); 15 gap> Polymake(rand,"N_VERTICES":PolymakeNolookup); 9