Opened 5 years ago

Last modified 4 years ago

#22605 closed defect

Better error handling of the polyhedron constructor for non-embedded NumberField and floats. — at Initial Version

Reported by: jipilab Owned by:
Priority: major Milestone: sage-8.1
Component: geometry Keywords: polyhedron, base ring
Cc: moritz, mkoeppe, vdelecroix, novoselt, tmonteil, tscrim Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


These error messages are not really informative of what the problem really is:

sage: K = NumberField(x^2-2,'s')
sage: s = K.0
sage: L = NumberField(x^3-2,'t')
sage: t = L.0
sage: P = Polyhedron(vertices = [[0,s],[t,0]])
Traceback (most recent call last):
AttributeError: 'Objects_with_category' object has no attribute 'is_exact'

similar problem with floats:

sage: f = float(1.1)
sage: f
sage: Polyhedron(vertices=[[f]])
AttributeError                            Traceback (most recent call last)
<ipython-input-55-aea1b8b1f057> in <module>()
----> 1 Polyhedron(vertices=[[f]])

/Users/jplab/sage/sage2/src/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport.__call__ (/Users/jplab/sage/sage2/src/build/cythonized/sage/misc/lazy_import.c:4007)()
    387             True
    388         """
--> 389         return self._get_object()(*args, **kwds)
    391     def __repr__(self):

/Users/jplab/sage/sage2/local/lib/python2.7/site-packages/sage/geometry/polyhedron/constructor.pyc in Polyhedron(vertices, rays, lines, ieqs, eqns, ambient_dim, base_ring, minimize, verbose, backend)
    490     # Specific backends can override the base_ring
    491     from sage.geometry.polyhedron.parent import Polyhedra
--> 492     parent = Polyhedra(base_ring, ambient_dim, backend=backend)
    493     base_ring = parent.base_ring()

/Users/jplab/sage/sage2/local/lib/python2.7/site-packages/sage/geometry/polyhedron/parent.pyc in Polyhedra(base_ring, ambient_dim, backend)
     89         elif base_ring is RDF:
     90             backend = 'cdd'
---> 91         elif base_ring.is_exact():
     92             backend = 'field'
     93         else:

AttributeError: type object 'float' has no attribute 'is_exact'

Change History (0)

Note: See TracTickets for help on using tickets.