Ticket #14394: trac_14394_face_fan_bug.patch

File trac_14394_face_fan_bug.patch, 2.5 KB (added by vbraun, 6 years ago)

Initial patch

  • sage/geometry/fan.py

    # HG changeset patch
    # User Volker Braun <vbraun.name@gmail.com>
    # Date 1364837624 -3600
    # Node ID e63d1bd15c2a687c6cb10f2c5849778ca80c8a91
    # Parent  1d7d862fceb20059914afb8726db4fe6243b6034
    Better input checking for FaceFan
    
    diff --git a/sage/geometry/fan.py b/sage/geometry/fan.py
    a b  
    601601    - ``polytope`` -- a :func:`polytope
    602602      <sage.geometry.polyhedron.constructor.Polyhedron>` over `\QQ` or
    603603      a :class:`lattice polytope
    604       <sage.geometry.lattice_polytope.LatticePolytopeClass>`.
     604      <sage.geometry.lattice_polytope.LatticePolytopeClass>`. A (not
     605      necessarily full-dimensional) polytope contaning the origin in
     606      its :meth:`relative interior
     607      <sage.geometry.polyhedron.base.Polyhedron_base.relative_interior_contains>`.
    605608
    606609    - ``lattice`` -- :class:`ToricLattice
    607610      <sage.geometry.toric_lattice.ToricLatticeFactory>`, `\ZZ^n`, or any
     
    665668        sage: FaceFan(interval_in_QQ2).generating_cones()
    666669        (1-d cone of Rational polyhedral fan in 2-d lattice N,
    667670         1-d cone of Rational polyhedral fan in 2-d lattice N)
     671
     672        sage: FaceFan(Polyhedron([(-1,0), (1,0), (0,1)])) # origin on facet
     673        Traceback (most recent call last):
     674        ...
     675        ValueError: face fans are defined only for
     676        polytopes containing the origin as an interior point!
    668677    """
    669678    from sage.geometry.lattice_polytope import is_LatticePolytope
    670679    interior_point_error = ValueError(
     
    676685        cones = (facet.vertices() for facet in polytope.facets())
    677686        rays = polytope.vertices().columns(copy=False)
    678687    else:
    679         if not (polytope.is_compact() and polytope.contains(polytope.ambient_space().zero())):
     688        origin = polytope.ambient_space().zero()
     689        if not (polytope.is_compact() and
     690                polytope.relative_interior_contains(origin)):
    680691            raise interior_point_error
    681692        cones = [ [ v.index() for v in facet.incident() ]
    682693                  for facet in polytope.inequalities() ]
     
    695706    - ``polytope`` -- a :func:`polytope
    696707      <sage.geometry.polyhedron.constructor.Polyhedron>` over `\QQ`
    697708      or:class:`lattice polytope
    698       <sage.geometry.lattice_polytope.LatticePolytopeClass>`.
     709      <sage.geometry.lattice_polytope.LatticePolytopeClass>`. A
     710      full-dimensional polytope containing the origin as an interior
     711      point.
    699712
    700713    - ``lattice`` -- :class:`ToricLattice
    701714      <sage.geometry.toric_lattice.ToricLatticeFactory>`, `\ZZ^n`, or any