# Ticket #14394: trac_14394_reviewer.patch

File trac_14394_reviewer.patch, 2.5 KB (added by novoselt, 6 years ago)
• ## sage/geometry/fan.py

```# HG changeset patch
# User Andrey Novoseltsev <novoselt@gmail.com>
# Date 1364881023 21600
# Node ID 8d16c45427d45f4b3c19c3a5ee618f062818c00c
# Parent  144c26a1c5f127cf5b3b79b405973448f2b39d0f
Reviewers tweaks to FaceFan and NormalFan.

diff --git a/sage/geometry/fan.py b/sage/geometry/fan.py```
 a def FaceFan(polytope, lattice=None): r""" Construct the face fan of the given lattice ``polytope``. Construct the face fan of the given rational ``polytope``. INPUT: 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() fan = Fan(cones, rays, lattice=lattice, check=False, is_complete=(polytope.dim() == polytope.ambient_dim())) return fan def NormalFan(polytope, lattice=None): r""" Construct the normal fan of the given lattice ``polytope``. Construct the normal fan of the given rational ``polytope``. INPUT: - ``polytope`` -- a :func:`polytope - ``polytope`` -- a full-dimensional :func:`polytope ` over `\QQ` or:class:`lattice polytope `. A full-dimensional polytope containing the origin as an interior point. `. - ``lattice`` -- :class:`ToricLattice `, `\ZZ^n`, or any 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).') raise NotImplementedError('the normal fan is only supported 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() fan = Fan(cones, rays, lattice=lattice, check=False, is_complete=(polytope.dim() == polytope.ambient_dim())) return fan