Skip to content

Two bugs with dilation #29899

@kliem

Description

@kliem

The new dilation with #29200 discovered two bugs:

sage: 2*Polyhedron([[]], backend='cdd')
...
TypeError ...

and

sage: K.<sqrt2> = QuadraticField(2)
sage: sqrt2*Polyhedron(backend='normaliz')
...
AttributeError

The underlying errors are the following:

sage: from sage.geometry.polyhedron.backend_cdd import Polyhedron_QQ_cdd
sage: from sage.geometry.polyhedron.parent import Polyhedra_QQ_cdd
sage: parent = Polyhedra_QQ_cdd(QQ, 0, 'cdd')
sage: p = Polyhedron_QQ_cdd(parent, [iter([]), iter([]), iter([])], None)
Traceback (most recent call last):
...
TypeError: can't multiply sequence by non-int of type 'NoneType'

sage: Polyhedron(ieqs=[], ambient_dim=5, backend='cdd')
Traceback (most recent call last):
...
TypeError: unsupported operand type(s) for -=: 'NoneType' and 'int'

sage: from sage.geometry.polyhedron.parent import Polyhedra_RDF_cdd
sage: from sage.geometry.polyhedron.backend_cdd import Polyhedron_RDF_cdd
sage: parent = Polyhedra_RDF_cdd(RDF, 1, 'cdd')
sage: Vrep = [[], [], [[1.0]]]
sage: Hrep = [[], []]
sage: p = Polyhedron_RDF_cdd(parent, Vrep, Hrep,
....:                        Vrep_minimal=True, Hrep_minimal=True) 
Traceback (most recent call last):
...
TypeError: unsupported operand type(s) for -=: 'NoneType' and 'int'

There are two tiny fixes to it:

  • Make sure to special-case the empty polyhedron in Polyhedron_base.__init__.
  • Add a trivial inequality for initialization of the universe polyhedron with backend cdd.

We add doctests for each fix. Note that #29907 will also indirectly test this.

CC: @jplab @LaisRast

Component: geometry

Keywords: polyhedra, dilation

Author: Jonathan Kliem

Branch: 0bb6413

Reviewer: Matthias Koeppe

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions