Direct Sum

Questions and problems about using polymake go here.
xavigrind
Posts: 2
Joined: 19 Dec 2013, 23:46

Direct Sum

Postby xavigrind » 19 Dec 2013, 23:56

Hi, I'm new here and I'm so lost. What I have to do is to compute the f-vector of the direct sum of two 3-dimensional permuthaedron of 24 vertices.

First of all, I think this is a truncate dodecahedron, so with this code I found those vertices:

-$oct = cross(3);
-$oct_trunc=truncation($oct,All);
-print $oct_trunc->VERTICES;

1 3/4 1/4 0
1 3/4 -1/4 0
1 3/4 0 1/4
1 3/4 0 -1/4
1 -3/4 1/4 0
1 -3/4 -1/4 0
1 -3/4 0 1/4
1 -3/4 0 -1/4
1 1/4 3/4 0
1 -1/4 3/4 0
1 0 3/4 1/4
1 0 3/4 -1/4
1 1/4 -3/4 0
1 -1/4 -3/4 0
1 0 -3/4 1/4
1 0 -3/4 -1/4
1 1/4 0 3/4
1 -1/4 0 3/4
1 0 1/4 3/4
1 0 -1/4 3/4
1 1/4 0 -3/4
1 -1/4 0 -3/4
1 0 1/4 -3/4
1 0 -1/4 -3/4

Now, I have a .cc program that calculate direct sum of two polytopes. BUt I don't know how to compile this,

I need two files, one of them will contains this vertices, and the other one the direct_sum.cc code, and I have to use polymake code to compute the direct sum and then calculate the f-vector.

Could you help me please?

PD: Sorry for my English

User avatar
assarf
Developer
Posts: 74
Joined: 12 Oct 2011, 15:52

Re: Direct Sum

Postby assarf » 20 Dec 2013, 09:44

Hi there,

when the .cc file contains all the required polymake declarations (like described here: http://www.polymake.org/doku.php/reference/clients ) then you just put your file in the folder:

Code: Select all

/path/to/polymake/apps/polytope/src/
and compile polymake again. Now your function should be available. How you use it in polymake is specified in the "glue declarations" part (see link above).

BUT: if you use the current perpetual beta version (link: http://www.polymake.org/doku.php/perpetualbeta ) then there is already a function called "free_sum" which takes two polytopes where the output is the free/direct sum of those two.

Example, take the free sum of the [-1,1] interval with itself. The output is the two dimensional cross polytope

Code: Select all

polytope > help 'free_sum'; functions/Producing a polytope from polytopes/free_sum: free_sum(P1, P2) -> Polytope Construct a new polyhedron as the free sum of two given pointed ones Arguments: Polytope P1 Polytope P2 Returns Polytope polytope > $p = new Polytope(POINTS=>[[1,-1],[1,1]]); polytope > $q = free_sum($p,$p); polymake: used package cddlib Implementation of the double description method of Motzkin et al. Copyright by Komei Fukuda. http://www.ifor.math.ethz.ch/~fukuda/cdd_home/cdd.html polytope > print $q->VERTICES; 1 -1 0 1 1 0 1 0 -1 1 0 1
hope that is what you are looking for.
no signature

xavigrind
Posts: 2
Joined: 19 Dec 2013, 23:46

Re: Direct Sum

Postby xavigrind » 21 Dec 2013, 15:32

Thanks, but that's not exactlly what I want. The thing is that I don't know how to compile, where I have to put my .cc code? What's the command I have to execute?

http://www.polymake.org/doku.php/reference/extensions

Explain me that I have to create an extension, but then, they told me to execute this command

extend_application "~/my_ext", "APP_NAME";

but I don't understand what's APP_NAME, is a folder I chave to create to put my .cc?

Sorry but I'm absolutelly lost in here.

User avatar
assarf
Developer
Posts: 74
Joined: 12 Oct 2011, 15:52

Re: Direct Sum

Postby assarf » 07 Jan 2014, 09:09

Hello,

when you want to enhance an existent application like "polytope" through an extension you need to specify which application(s) you want to enhance. Therefore the "APP_NAME" in the extend_application command (Quote from the extensions page: "where APP_NAME is the name of an existing application you are going to enhance."). In your case this would probably be

Code: Select all

extend_application "~/my_ext", "polytope";
Then it is basically the same process as I described before. In a bit more detail
  • make sure your .cc file contains all the required polymake declarations (like described here: http://www.polymake.org/doku.php/reference/clients )
  • put it in "~/my_ext/apps/polytope/src/"
  • when you start polymake it should compile your code automatically. If not you can do so by typing "make -C ~/my_ext"
now it should compile your code within polymake. How you call your code in polymake depends on the command you specified in the "glue declarations". You might want to look at a simple client if you need an example for the modifications you have to do to your .cc (maybe /path/to/polymake/apps/polytope/src/join_polytopes.cc would be a good example to look at)

one remark though. On the extension page there is a note:
Note
Extension management has been completely reworked prior to polymake snapshot version 2.12.4. All commands and procedures depicted below are only applicable to this snapshot or later releases. Please refer to the older version of this page for description pertaining to polymake 2.12 or earlier.
So you should use the latest perpetual beta version for this.

hope that helps.

PS: Alternatively if you do not want to go through the hassle of creating an extension, and if you have access to the polymake root directory, you could just place the .cc file in "/path/to/polymake/apps/polytope/src" and recompile by just typing "make" and "make install" in the polymake main directory.
no signature


Return to “Helpdesk”