def verify(self, inequalities, equations):
        """
        Compare result to PPL if the base ring is QQ.

        This method is for debugging purposes and compares the
        computation with another backend if available.

        INPUT:

        - ``inequalities``, ``equations`` -- see :class:`Hrep2Vrep`.

        EXAMPLES::

            sage: from sage.geometry.polyhedron.double_description_inhomogeneous import Hrep2Vrep
            sage: H = Hrep2Vrep(QQ, 1, [(1,2)], [])
            sage: H.verify([(1,2)], [])
        """
        from sage.rings.all import QQ
        from sage.geometry.polyhedron.constructor import Polyhedron
        if self.base_ring is not QQ:
            return
        P = Polyhedron(vertices=self.vertices, rays=self.rays, lines=self.lines,
                       base_ring=QQ, ambient_dim=self.dim, backend='ppl')
        Q = Polyhedron(ieqs=inequalities, eqns=equations,
                       base_ring=QQ, ambient_dim=self.dim, backend='ppl')
        if (P != Q) or \
           (len(self.vertices) != P.n_vertices()) or \
           (len(self.rays) != P.n_rays()) or \
           (len(self.lines) != P.n_lines()):
            print('incorrect!', end="")
            print(Q.Vrepresentation())
            print(P.Hrepresentation())
Пример #2
0
    def verify(self, inequalities, equations):
        """
        Compare result to PPL if the base ring is QQ.

        This method is for debugging purposes and compares the
        computation with another backend if available.

        INPUT:

        - ``inequalities``, ``equations`` -- see :class:`Hrep2Vrep`.

        EXAMPLES::

            sage: from sage.geometry.polyhedron.double_description_inhomogeneous import Hrep2Vrep
            sage: H = Hrep2Vrep(QQ, 1, [(1,2)], [])
            sage: H.verify([(1,2)], [])
        """
        from sage.rings.all import QQ
        from sage.geometry.polyhedron.constructor import Polyhedron
        if self.base_ring is not QQ:
            return
        P = Polyhedron(vertices=self.vertices, rays=self.rays, lines=self.lines,
                       base_ring=QQ, ambient_dim=self.dim, backend='ppl')
        Q = Polyhedron(ieqs=inequalities, eqns=equations,
                       base_ring=QQ, ambient_dim=self.dim, backend='ppl')
        if (P != Q) or \
           (len(self.vertices) != P.n_vertices()) or \
           (len(self.rays) != P.n_rays()) or \
           (len(self.lines) != P.n_lines()):
            print 'incorrect!',
            print Q.Vrepresentation()
            print P.Hrepresentation()