QuadraticExtension in Polymake 3.0

Questions and problems about using polymake go here.
User avatar
joswig
Main Author
Posts: 280
Joined: 24 Dec 2010, 11:10

Re: QuadraticExtension in Polymake 3.0

Postby joswig » 31 Jan 2016, 21:28

The code you are listing interfaces to the Parma Polyhedra Library (ppl). However, ppl (which is an independent software project) does not support other coordinates than rational numbers. The only convex hull algorithm available from within polymake which can use (suitably adapted) field coefficients is polymake's own beneath_beyond.

mws
Posts: 32
Joined: 16 Jan 2014, 22:57

Re: QuadraticExtension in Polymake 3.0

Postby mws » 01 Feb 2016, 10:58

Ok, I see. Then I have three questions:
  • How exactly do I use beneath-beyond with the callable library? Could someone maybe provide a minimal working example?
  • Does it use Perl in any way? I am just asking because I would like to avoid since it slows down computations greatly in my experience.
  • What exactly do you mean by "suitably adapted"? Just that all coordinates have to come from the same quadratic extension?
Thanks!

blorenz
Developer
Posts: 139
Joined: 10 Jan 2011, 17:21

Re: QuadraticExtension in Polymake 3.0

Postby blorenz » 01 Feb 2016, 12:57

A short example to use beneath_beyond from C++ code without using any perl (apart from the generation of the input data):

Code: Select all

#include <polymake/polytope/beneath_beyond.h> ... // create some input data perl::Object p = CallPolymakeFunction("johnson_solid",91); Matrix<QuadraticExtension<Rational> > V = p.give("VERTICES"); // the 'true' at the end tells the algorithm that the input points are already vertices // in general you probably want 'false' there polytope::beneath_beyond_algo<QuadraticExtension<Rational> > algo(V,true); // the (end-sensitive) iterator specifies the insertion order of the points algo.compute(entire(sequence(0,V.rows()))); Matrix<QuadraticExtension<Rational> > F = algo.getFacets();
For QuadraticExtension it suffices that all coordinates are from the same one. The suitably adapted remark probably refers to the fact that the beneath and beyond implementation also supports other field types as long as they satisfy some conditions on the available operators / methods.

Best,
Benjamin

mws
Posts: 32
Joined: 16 Jan 2014, 22:57

Re: QuadraticExtension in Polymake 3.0

Postby mws » 01 Feb 2016, 21:48

Dear Benjamin,

Thanks for your helpful reply. Since my polytopes are defined via hyperplanes and not points, I looked at beneath_beyond.h to find the appropriate constructor. Unfortunately I couldn't find anything. However, I guess that I am missing something... So can you maybe tell me how to you use Polymake's beneath beyond algorithm with hyperplanes?

Thanks,
Moritz

User avatar
gawrilow
Main Author
Posts: 423
Joined: 25 Dec 2010, 17:40

Re: QuadraticExtension in Polymake 3.0

Postby gawrilow » 01 Feb 2016, 22:28

Exactly the same: call it with a matrix with inequalities and a boolean flag indicating whether they are known to be facets, that is, complete and not redundant. Then Facets() will in fact deliver the vertices. Just have a look into apps/polytope/src/beneath_beyond.cc, the code is pretty much self-explanatory for those familiar with polymake basics (and you seem to be far above that level).

mws
Posts: 32
Joined: 16 Jan 2014, 22:57

Re: QuadraticExtension in Polymake 3.0

Postby mws » 02 Feb 2016, 12:39

Just to make sure that I understand your answer correctly: You suggest to use something like

Code: Select all

polymake::polytope::beneath_beyond_algo<polymake::QuadraticExtension<polymake::Rational>> algo(H, false); algo.compute(polymake::entire(polymake::sequence(0, H.rows()))); polymake::Matrix<polymake::QuadraticExtension<polymake::Rational> > V = algo.getVertices();
with H being a matrix of type polymake::Matrix<QuadraticExtension<polymake::Rational>> containing my (affine, not necessarily facet defining) hyperplanes. This should compute the vertices of the polytope defined by H, right?

And your hint to look at beneath_beyond.cc was just for me to learn about the different method names to compute stuff -- Это верно?

I am just being so insistent because the above code yields a segfault for me.

User avatar
gawrilow
Main Author
Posts: 423
Joined: 25 Dec 2010, 17:40

Re: QuadraticExtension in Polymake 3.0

Postby gawrilow » 02 Feb 2016, 15:02

Your use case exactly corresponds to the dual mode of beneath_beyond client. getVertices() would give you the facets of your polyhedron, and getFacets() would give you the vertices.

Regarding the segfault: could you please feed your inequalities into polymake via callable library methods:

Code: Select all

perl::Main pmain; pmain.set_application("polytope"); Matrix< QuadraticExtension<Rational> > H(...); perl::Object poly("Polytope<QuadraticExtension<Rational>>"); poly.take("INEQUALITIES") << H; perl::Scope psc=pmain.newScope(); psc.prefer_now("beneath_beyond"); Matrix< QuadraticExtension<Rational> > V = poly.give("VERTICES"); cout << V;
It's advisable to build this program in debug mode first (make Debug=y); it will activate various sanity checks.

mws
Posts: 32
Joined: 16 Jan 2014, 22:57

Re: QuadraticExtension in Polymake 3.0

Postby mws » 03 Feb 2016, 22:22

Ok, I finally understood the segfaults. They seem to have occured because I used

Code: Select all

polymake::Main pm; pm.set_application("polytope");
too late in my code.

Thanks to all who have taken the time to contribute to this thread -- you have helped me a great deal!


Return to “Helpdesk”