Skip to content

#29843 introduces a bug in Polyhedron().linear_transformation #30146

@Etn40ff

Description

@Etn40ff

In 9.2.beta5 applying linear transformations to a polyhedron containing a ray is broken:

sage: Polyhedron(rays=[(0,1)]).linear_transformation(identity_matrix(2))
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-185-3c5f2df4fe7c> in <module>()
----> 1 Polyhedron(rays=[(Integer(0),Integer(1))]).linear_transformation(identity_matrix(Integer(2)))

/opt/sage/sage/local/lib/python3.7/site-packages/sage/geometry/polyhedron/base.py in linear_transformation(self, linear_transf, new_base_ring)
   5093 
   5094             sage: P = Polyhedron([(0,0),(1,1)], base_ring=ZZ)
-> 5095             sage: P.intersection(P)
   5096             A 1-dimensional polyhedron in ZZ^2 defined as the convex hull of 2 vertices
   5097             sage: Q = Polyhedron([(0,1),(1,0)], base_ring=ZZ)

/opt/sage/sage/local/lib/python3.7/site-packages/sage/geometry/polyhedron/base.py in __init__(self, parent, Vrep, Hrep, Vrep_minimal, Hrep_minimal, pref_rep, **kwds)
    218         # TODO: find something better *but* fast
    219         return hash((self.dim(),
--> 220                      self.ambient_dim(),
    221                      self.n_Hrepresentation(),
    222                      self.n_Vrepresentation(),

/opt/sage/sage/local/lib/python3.7/site-packages/sage/geometry/polyhedron/backend_ppl.py in _init_from_Vrepresentation(self, vertices, rays, lines, minimize, verbose)
     75             d = LCM_list([denominator(r_i) for r_i in r])
     76             if d.is_one():
---> 77                 gs.insert(ray(Linear_Expression(r, 0)))
     78             else:
     79                 dr = [ d*r_i for r_i in r ]

ppl/generator.pyx in ppl.generator.Generator.ray()

ppl/generator.pyx in ppl.generator.Generator.ray()

ValueError: PPL::ray(e):
e == 0, but the origin cannot be a ray.

this used to work just fine in 9.2.beta4.

git bisect seems to blame the regression on #29843

CC: @jplab @LaisRast @kliem @mkoeppe

Component: geometry

Keywords: combinatorial polyhedron, linear transformation

Author: Jonathan Kliem

Branch/Commit: c9c7b63

Reviewer: Matthias Koeppe

Issue created by migration from https://trac.sagemath.org/ticket/30146

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions