Page 1 of 1

Face lattices of polytopes

Posted: 28 Apr 2017, 11:52
by ren
I have a small problem with face lattices of polytopes. The following code from the tutorial (https://polymake.org/doku.php/tutorial/ ... e_tutorial) does not work anymore:

Code: Select all

$p = n_gon(5); $HD = $p->HASSE_DIAGRAM; for (my $k=$HD->DIMS->[1]; $k<$HD->DIMS->[2]; ++$k) { print $HD->FACES->[$k] }
Here is the error that I get from both my local polymake and the web interface:

Code: Select all

polytope > $p = n_gon(5); polytope > $HD = $p->HASSE_DIAGRAM; polymake: used package ppl The Parma Polyhedra Library (PPL): A C++ library for convex polyhedra and other numerical abstractions. http://www.cs.unipr.it/ppl/ polytope > for (my $k=$HD->DIMS->[1]; $k<$HD->DIMS->[2]; ++$k) { print $HD->FACES->[$k] } polymake: WARNING: available properties insufficient to compute 'DIMS' polymake: ERROR: Can't use an undefined value as an ARRAY reference at input line 1.
The face lattice is incredibly useful for computing resolution of certain classes of hypersurface singularities. :)

Re: Face lattices of polytopes

Posted: 28 Apr 2017, 15:10
by joswig
Thanks for pointing this out. The tutorial will be corrected.

The property DIMS was sacrificed in the last refactoring. This is now replaced by a more fancy mechanism. E.g., you can do

Code: Select all

print $HD->INVERSE_RANK_MAP->nodes_of_rank(2);
to obtain the indices of the faces of rank 2 (i.e., the edges). The resulting numbers can be applied as indices, i.e., to the DECORATION property.

Re: Face lattices of polytopes

Posted: 28 Apr 2017, 15:21
by blorenz
The tutorial is now updated.

There is also a shortcut to get the nodes of a given dimension (in contrast to the rank):

Code: Select all

print $p->HASSE_DIAGRAM->nodes_of_dim(1);
Or printing the faces (and this should work with both 3.0 and 3.1):

Code: Select all

print map { $p->HASSE_DIAGRAM->FACES->[$_] } @{$p->HASSE_DIAGRAM->nodes_of_dim(1)};

Re: Face lattices of polytopes

Posted: 28 Apr 2017, 15:22
by ren
Thanks alot, that will make my code even cleaner now. I was wondering how to obtain the decorations... :)