Hello, I'm still trying to wrap cddlib by to python and, as it is beginning to work, I wonder now how it should be integrated into sage. In particular I think that polyhedra.py may benefit some refactoring. At least, the topic is worth a discussion.
About polyhedron representation ~~~~~~~~~~~~~~~~~~~~~~~~ Any polyhedron admits two representations, let's call them Hrep and Vrep. Currently, a single polyhedron class supports both representations and calls cdd to convert from one to the other. This conversion is done automatically as needed. This can be a problem * in high dimensional spaces as the conversion is computationally intensive * when using cdd with floats as the conversion leads to approximations that can in turn lead to inconsistent representation, * handling both representation together leads to lot of tricky boundary cases. For these reasons * I would prefer to have the conversion explicit rather than automatic * we could split the current class into several ones, like HrepPolyhedron, VrepPolyhedron (and maybe also DoubleRepPolyhedron) inheriting from a common generic Polyhedron class. About vertices, inequalities, etc. datatype ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Currently, the Polyhedron class stores vertices and inequalites as a python list of coordinates lists. This has two advantages: * it has small dependency over other code * it works for any coordinate datatype. In particular, cddlib can be compiled to work with C double and rational coordinates, both can be transparently stored in python lists. However, we could store them in matrix types and expect * easier consistency checks * fancy slicing * better integration in sage * faster code Currently, I only wrapped the part of cdd working on float coordinates, and it outputs numpy arrays. Before continuing, I would like to know if you prefer it to output lists (or sage matrices, or...). Again, one would expect two distinct classes for polyhedron over RR or QQ. However, as this aspect is orthogonal to the previous one, it would lead to 2*2 (or 2*3) distinct classes. What do you think about it? Dimension specific code ~~~~~~~~~~~~~~~~~~ some methods in Polyhedron class only work in 2 or 3 dimension spaces (mostly visualization tools) shouldn't we move them into a subclass? any thought? -- Sébastien Barthélemy --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---