Opened 8 years ago
Closed 5 years ago
#17264 closed defect (wontfix)
Polyhedron function broken with floats in sage-6.3 (worked in sage-6.2)
Reported by: | William Stein | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | sage-duplicate/invalid/wontfix |
Component: | geometry | Keywords: | days88 |
Cc: | Merged in: | ||
Authors: | Reviewers: | Vincent Delecroix, Jean-Philippe Labbé | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
If you try to make the convex hull of a set of points given by float coordinates using Polyhedron
, this worked fine in Sage-6.2, but is broken in Sage-6.3.
sage: Polyhedron([(0.8370682893845995r, 0.2027977776670088r, 0.2547890063224252r)]) AttributeError: type object 'float' has no attribute 'fraction_field' sage: Polyhedron([(0.8370682893845995, 0.2027977776670088, 0.2547890063224252)]) A 0-dimensional polyhedron in (Real Field with 54 bits of precision)^3 defined as the convex hull of 1 vertex
I noticed when making this interact:
This is also still broken in sage-6.4.rc0:
/scratch/wstein/sage-6.4.rc0$ ./sage ┌────────────────────────────────────────────────────────────────────┐ │ Sage Version 6.4.rc0, Release Date: 2014-10-30 │ │ Type "notebook()" for the browser-based notebook interface. │ │ Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Warning: this is a prerelease version, and it may be unstable. ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ sage: Polyhedron([(0.8370682893845995r, 0.2027977776670088r, 0.2547890063224252r)]) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-1-69a05f87fbc6> in <module>() ----> 1 Polyhedron([(0.8370682893845995, 0.2027977776670088, 0.2547890063224252)]) /scratch/wstein/sage-6.4.rc0/local/lib/python2.7/site-packages/sage/misc/lazy_import.so in sage.misc.lazy_import.LazyImport.__call__ (build/cythonized/sage/misc/laz y_import.c:3230)() /scratch/wstein/sage-6.4.rc0/local/lib/python2.7/site-packages/sage/misc/decorators.pyc in wrapper(*args, **kwds) 703 kwds[new_name] = kwds[old_name] 704 del kwds[old_name] --> 705 return func(*args, **kwds) 706 707 return wrapper /scratch/wstein/sage-6.4.rc0/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) 444 # Specific backends can override the base_ring 445 from sage.geometry.polyhedron.parent import Polyhedra --> 446 parent = Polyhedra(base_ring, ambient_dim, backend=backend) 447 base_ring = parent.base_ring() 448 /scratch/wstein/sage-6.4.rc0/local/lib/python2.7/site-packages/sage/geometry/polyhedron/parent.pyc in Polyhedra(base_ring, ambient_dim, backend) 84 return Polyhedra_RDF_cdd(RDF, ambient_dim) 85 elif backend == 'field': ---> 86 return Polyhedra_field(base_ring.fraction_field(), ambient_dim) 87 else: 88 raise ValueError('No such backend (='+str(backend)+ AttributeError: type object 'float' has no attribute 'fraction_field' sage:
Change History (11)
comment:1 Changed 8 years ago by
Summary: | Polyhedron function broken in sage-6.3 (worked in sage-6.2) → Polyhedron function broken with floats in sage-6.3 (worked in sage-6.2) |
---|
comment:2 Changed 8 years ago by
Probably. is_field(float)
does not work as well, by the way.
The fix is to either allow float
though as the base field or replace it with RDF. I suspect the second option is less error-prone.
comment:5 Changed 6 years ago by
In 7.6.rc0 it now gives:
sage: Polyhedron(vertices = [(0.8370682893845995r, 0.2027977776670088r, 0.2547890063224252r)]) Traceback (most recent call last): ... 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'
and
sage: Polyhedron([(0.8370682893845995, 0.2027977776670088, 0.2547890063224252)]) Traceback (most recent call last): ... ValueError: no appropriate backend for computations with Real Field with 54 bits of precision
The last one is caused by #18220.
I guess that the first one should also return a ValueError
saying that no backend deals with polyhedron over floats.
Maybe even a pointer to say that it should be done in RDF
?
comment:6 Changed 6 years ago by
The ticket #22605 aims to make the error messages for base ring more informative and suggested to redirect floats to the base ring RDF
.
comment:7 Changed 5 years ago by
Milestone: | sage-6.4 → sage-duplicate/invalid/wontfix |
---|---|
Status: | new → needs_review |
Fixed (or at least coherent) in 8.1.beta2
sage: Polyhedron([(0.8370682893845995r, 0.2027977776670088r, 0.2547890063224252r)]) A 0-dimensional polyhedron in RDF^3 defined as the convex hull of 1 vertex sage: Polyhedron([(0.8370682893845995, 0.2027977776670088, 0.2547890063224252)]) Traceback (most recent call last): ... ValueError: no appropriate backend for computations with Real Field with 54 bits of precision
(see #22605)
comment:8 Changed 5 years ago by
Keywords: | days88 added |
---|---|
Status: | needs_review → positive_review |
Indeed, #22605 seems to deal with that issue properly.
comment:10 Changed 5 years ago by
Reviewers: | → Vincent Delecroix, Jean-Philippe Labbé |
---|
Nothing was written so we won't put authors...
comment:11 Changed 5 years ago by
Resolution: | → wontfix |
---|---|
Status: | positive_review → closed |
Is this only true for floats, though?