Commits

Volker Braun  committed 71e0b29

update to sage-5.9.beta4

  • Participants
  • Parent commits aef7063

Comments (0)

Files changed (3)

+trac_14371_dont_catch_runtimeerror.patch
 trac_14409_geometry_sage_input.patch
-trac_13194_polytope_fan_construct.patch
 trac_14394_face_fan_bug.patch
 trac_14394_reviewer.patch
 trac_14375_ansi_escapes_indication.2.patch

File trac_13194_polytope_fan_construct.patch

-# HG changeset patch
-# Parent 263b76d1bea7c779e4386ae0308024857de14a7b
-
-Construct NormalFan and FaceFan from QQ-polytopesa
-
-diff --git a/sage/geometry/fan.py b/sage/geometry/fan.py
---- a/sage/geometry/fan.py
-+++ b/sage/geometry/fan.py
-@@ -576,8 +576,10 @@
- 
-     INPUT:
- 
--    - ``polytope`` -- :class:`lattice polytope
--      <sage.geometry.lattice_polytope.LatticePolytopeClass>`;
-+    - ``polytope`` -- a :func:`polytope
-+      <sage.geometry.polyhedron.constructor.Polyhedron>` over `\QQ` or
-+      a :class:`lattice polytope
-+      <sage.geometry.lattice_polytope.LatticePolytopeClass>`.
- 
-     - ``lattice`` -- :class:`ToricLattice
-       <sage.geometry.toric_lattice.ToricLatticeFactory>`, `\ZZ^n`, or any
-@@ -616,12 +618,47 @@
-         N( 0, 1),
-         N(-1, 0)
-         in 2-d lattice N
-+
-+        sage: cuboctahed = polytopes.cuboctahedron()
-+        sage: FaceFan(cuboctahed)
-+        Rational polyhedral fan in 3-d lattice N
-+
-+    TESTS::
-+
-+        sage: cuboctahed.is_lattice_polytope(), cuboctahed.dilation(2).is_lattice_polytope()
-+        (False, True)
-+        sage: fan1 = FaceFan(cuboctahed)
-+        sage: fan2 = FaceFan(cuboctahed.dilation(2).lattice_polytope())
-+        sage: fan1.is_equivalent(fan2)
-+        True
-+
-+        sage: ray = Polyhedron(vertices=[(-1,-1)], rays=[(1,1)])
-+        sage: FaceFan(ray)
-+        Traceback (most recent call last):
-+        ...
-+        ValueError: face fans are defined only for
-+        polytopes containing the origin as an interior point!
-+
-+        sage: interval_in_QQ2 = Polyhedron([ (0,-1), (0,+1) ])
-+        sage: FaceFan(interval_in_QQ2).generating_cones()
-+        (1-d cone of Rational polyhedral fan in 2-d lattice N, 
-+         1-d cone of Rational polyhedral fan in 2-d lattice N)
-     """
--    if any(d <= 0 for d in polytope.distances([0]*polytope.dim())):
--        raise ValueError("face fans are defined only for polytopes containing"
--                         "the origin as an interior point!")
--    cones = (facet.vertices() for facet in polytope.facets())
--    rays = polytope.vertices().columns(copy=False)
-+    from sage.geometry.lattice_polytope import is_LatticePolytope
-+    interior_point_error = ValueError(
-+        "face fans are defined only for polytopes containing "
-+        "the origin as an interior point!")
-+    if is_LatticePolytope(polytope):
-+        if any(d <= 0 for d in polytope.distances([0]*polytope.dim())):
-+            raise interior_point_error
-+        cones = (facet.vertices() for facet in polytope.facets())
-+        rays = polytope.vertices().columns(copy=False)
-+    else:
-+        if not (polytope.is_compact() and polytope.contains(polytope.ambient_space().zero())):
-+            raise interior_point_error
-+        cones = [ [ v.index() for v in facet.incident() ]
-+                  for facet in polytope.inequalities() ]
-+        rays = map(vector, polytope.vertices())
-     fan = Fan(cones, rays, lattice=lattice, check=False)
-     fan._is_complete = polytope.dim() == polytope.ambient_dim()
-     return fan
-@@ -633,8 +670,10 @@
- 
-     INPUT:
- 
--    - ``polytope`` -- :class:`lattice polytope
--      <sage.geometry.lattice_polytope.LatticePolytopeClass>`;
-+    - ``polytope`` -- a :func:`polytope
-+      <sage.geometry.polyhedron.constructor.Polyhedron>` over `\QQ`
-+      or:class:`lattice polytope
-+      <sage.geometry.lattice_polytope.LatticePolytopeClass>`.
- 
-     - ``lattice`` -- :class:`ToricLattice
-       <sage.geometry.toric_lattice.ToricLatticeFactory>`, `\ZZ^n`, or any
-@@ -673,9 +712,32 @@
-         N( 0, 1),
-         N(-1, 0)
-         in 2-d lattice N
-+
-+        sage: cuboctahed = polytopes.cuboctahedron()
-+        sage: NormalFan(cuboctahed)
-+        Rational polyhedral fan in 3-d lattice N
-+
-+    TESTS::
-+
-+        sage: cuboctahed.is_lattice_polytope(), cuboctahed.dilation(2).is_lattice_polytope()
-+        (False, True)
-+        sage: fan1 = NormalFan(cuboctahed)
-+        sage: fan2 = NormalFan(cuboctahed.dilation(2).lattice_polytope())
-+        sage: fan1.is_equivalent(fan2)
-+        True
-     """
--    rays = (polytope.facet_normal(i) for i in range(polytope.nfacets()))
--    cones = (vertex.facets() for vertex in polytope.faces(dim=0))
-+    from sage.geometry.lattice_polytope import is_LatticePolytope
-+    if polytope.dim() != polytope.ambient_dim():
-+        raise ValueError('the normal fan is only defined for full-dimensional polytopes')
-+    if is_LatticePolytope(polytope):
-+        rays = (polytope.facet_normal(i) for i in range(polytope.nfacets()))
-+        cones = (vertex.facets() for vertex in polytope.faces(dim=0))
-+    else:
-+        if not polytope.is_compact():
-+            raise ValueError('the normal fan is only defined for polytopes (compact polyhedra).')
-+        cones = [ [ ieq.index() for ieq in vertex.incident() ]
-+                  for vertex in polytope.vertices() ]
-+        rays =[ ieq.A() for ieq in polytope.inequalities() ]
-     fan = Fan(cones, rays, lattice=lattice, check=False)
-     fan._is_complete = polytope.dim() == polytope.ambient_dim()
-     return fan

File trac_14371_dont_catch_runtimeerror.patch

+# HG changeset patch
+# Parent 99a6c4527bb9f7cf93eada1f63a08787d4e68cad
+
+Don't use RuntimeError for Singular interpreter errors
+
+diff --git a/sage/interfaces/singular.py b/sage/interfaces/singular.py
+--- a/sage/interfaces/singular.py
++++ b/sage/interfaces/singular.py
+@@ -341,6 +341,12 @@
+ 
+ from sage.misc.misc import get_verbose
+ 
++class SingularError(Exception):
++    """
++    Raised if Singular printed an error message
++    """
++    pass
++
+ class Singular(Expect):
+     r"""
+     Interface to the Singular interpreter.
+@@ -580,7 +586,7 @@
+         s = Expect.eval(self, x, **kwds)
+ 
+         if s.find("error") != -1 or s.find("Segment fault") != -1:
+-            raise RuntimeError, 'Singular error:\n%s'%s
++            raise SingularError('Singular error:\n%s'%s)
+ 
+         if get_verbose() > 0:
+             ret = []
+@@ -620,12 +626,10 @@
+             '0'
+ 
+         """
+-        cmd = ''.join('if(defined(%s)){kill %s;};'%(v,v) for v in self.__to_clear) + '%s %s=%s;'%(type, name, value)
++        cmd = ''.join('if(defined(%s)){kill %s;};'%(v,v) for v in self.__to_clear) + \
++            '%s %s=%s;'%(type, name, value)
+         self.__to_clear = []
+-        try:
+-            out = self.eval(cmd)
+-        except RuntimeError, msg:
+-            raise TypeError, msg
++        self.eval(cmd)
+ 
+     def get(self, var):
+         """
+@@ -1184,7 +1188,7 @@
+                 self._name = parent._create( value, type)
+             # Convert RuntimeError to TypeError for
+             # coercion to work properly.
+-            except RuntimeError, x:
++            except SingularError as x:
+                 self._session_number = -1
+                 raise TypeError, x
+             except BaseException:
+diff --git a/sage/rings/polynomial/multi_polynomial_ideal.py b/sage/rings/polynomial/multi_polynomial_ideal.py
+--- a/sage/rings/polynomial/multi_polynomial_ideal.py
++++ b/sage/rings/polynomial/multi_polynomial_ideal.py
+@@ -374,13 +374,14 @@
+             7*b+210*c^3-79*c^2+3*c,
+             7*a-420*c^3+158*c^2+8*c-7
+         """
++        from sage.interfaces.singular import SingularError
+         try:
+             self.bck_degBound = int(self.singular.eval('degBound'))
+-        except RuntimeError:
++        except SingularError:
+             self.bck_degBound = int(0)
+         try:
+             self.bck_multBound = int(self.singular.eval('multBound'))
+-        except RuntimeError:
++        except SingularError:
+             self.bck_multBound = int(0)
+         self.o = self.singular.option("get")
+         self.singular.option('set',self.singular._saved_options)
+@@ -388,11 +389,11 @@
+         self.singular.option("redTail")
+         try:
+             self.singular.eval('degBound=0')
+-        except RuntimeError:
++        except SingularError:
+             pass
+         try:
+             self.singular.eval('multBound=0')
+-        except RuntimeError:
++        except SingularError:
+             pass
+ 
+     def __exit__(self, typ, value, tb):
+@@ -411,14 +412,15 @@
+             7*b+210*c^3-79*c^2+3*c,
+             7*a-420*c^3+158*c^2+8*c-7
+         """
++        from sage.interfaces.singular import SingularError
+         self.singular.option("set",self.o)
+         try:
+             self.singular.eval('degBound=%d'%self.bck_degBound)
+-        except RuntimeError:
++        except SingularError:
+             pass
+         try:
+             self.singular.eval('multBound=%d'%self.bck_multBound)
+-        except RuntimeError:
++        except SingularError:
+             pass
+ 
+ def singular_standard_options(func):