Ticket #12892: trac_12892_reviewer.patch

File trac_12892_reviewer.patch, 10.7 KB (added by Andrey Novoseltsev, 10 years ago)
  • sage/geometry/fan_morphism.py

    # HG changeset patch
    # User Andrey Novoseltsev <novoselt@gmail.com>
    # Date 1342675330 21600
    # Node ID 96dfb20d1bfe63dfa1d37ccb715e5688901d6f78
    # Parent  205fce40de9346e75516c299e17bed3088db7e44
    Reviewer changes to toric morphisms.
    
    diff --git a/sage/geometry/fan_morphism.py b/sage/geometry/fan_morphism.py
    a b  
    16871687       
    16881688            sage: psi.restrict_to_image() is psi
    16891689            True
     1690           
     1691        TESTS::
     1692       
     1693            sage: trivialfan2 = Fan([],[],lattice=ToricLattice(2))
     1694            sage: trivialfan3 = Fan([],[],lattice=ToricLattice(3))
     1695            sage: f = FanMorphism(zero_matrix(2,3), trivialfan2, trivialfan3)
     1696            sage: f.restrict_to_image()
     1697            Fan morphism defined by the matrix
     1698            []
     1699            Domain fan: Rational polyhedral fan in 2-d lattice N
     1700            Codomain fan: Rational polyhedral fan in Sublattice <>
    16901701        """
    16911702        L = self.image().saturation()
    16921703        d = L.dimension()
     
    16941705            return self
    16951706        m = self.matrix()
    16961707        m = matrix(ZZ, m.nrows(), d, (L.coordinates(c) for c in m.rows()))
    1697         L_cone = Cone(sum(([g, -g] for g in L.gens()), []))
    1698         Sigma = Fan(cones=discard_faces(L_cone.intersection(cone)
    1699                                         for cone in self.codomain_fan()),
    1700                     lattice=L, check=False)
     1708        L_cone = Cone(sum(([g, -g] for g in L.gens()), []), lattice=L)
     1709        Sigma = Fan(cones=(L_cone.intersection(cone)
     1710                           for cone in self.codomain_fan()),
     1711                    lattice=L, discard_faces=True, check=False)
    17011712        return FanMorphism(m, self.domain_fan(), Sigma)
    17021713
    17031714    def relative_star_generators(self, domain_cone):
    17041715        """
    1705         Returns the relative star of ``domain_cone``.
     1716        Return the relative star generators of ``domain_cone``.
     1717       
     1718        INPUT:
     1719       
     1720        - ``domain_cone`` -- a cone of the :meth:`domain_fan` of ``self``.
     1721       
     1722        OUTPUT:
     1723       
     1724        - :meth:`~RationalPolyhedralFan.star_generators` of ``domain_cone``
     1725          viewed as a cone of :meth:`preimage_fan` of :meth:`image_cone` of
     1726          ``domain_cone``.
    17061727
    17071728        EXAMPLES::
    17081729
     
    17191740        base_cone = self.image_cone(domain_cone)
    17201741        preimg_fan = self.preimage_fan(base_cone)
    17211742        return preimg_fan.embed(domain_cone).star_generators()
    1722        
  • sage/geometry/point_collection.pyx

    diff --git a/sage/geometry/point_collection.pyx b/sage/geometry/point_collection.pyx
    a b  
    170170        self._points = tuple(points)
    171171        self._module = self._points[0].parent() if module is None else module
    172172
     173    def __add__(left, right):
     174        r"""
     175        Return the joint point collection.
     176
     177        INPUT:
     178       
     179        - ``left`` -- a :class:`PointCollection`;
     180
     181        - ``right`` -- a :class:`PointCollection`.
     182       
     183        OUTPUT:
     184       
     185        - a :class:`PointCollection`.
     186
     187        TESTS::
     188
     189            sage: c = Cone([(0,0,1), (1,0,1), (0,1,1), (1,1,1)]).rays()
     190            sage: c + c
     191            N(0, 0, 1),
     192            N(1, 0, 1),
     193            N(0, 1, 1),
     194            N(1, 1, 1),
     195            N(0, 0, 1),
     196            N(1, 0, 1),
     197            N(0, 1, 1),
     198            N(1, 1, 1)
     199            in 3-d lattice N
     200        """
     201        if not (isinstance(left, PointCollection) and
     202                isinstance(right, PointCollection)):
     203            raise NotImplementedError
     204        cdef PointCollection left_pc = left
     205        cdef PointCollection right_pc = right
     206        if not left_pc._module is right_pc._module:
     207            raise NotImplementedError
     208        return PointCollection(left_pc._points + right_pc._points,
     209                               left_pc._module)
     210
    173211    def __call__(self, *args):
    174212        r"""
    175213        Return a subcollection of ``self``.
     
    407445        EXAMPLES::
    408446
    409447            sage: c = Cone([(0,0,1), (1,0,1), (0,1,1), (1,1,1)]).rays()
    410             sage: matrix(c)
     448            sage: matrix(c) # indirect doctest
    411449            [0 0 1]
    412450            [1 0 1]
    413451            [0 1 1]
  • sage/schemes/toric/morphism.py

    diff --git a/sage/schemes/toric/morphism.py b/sage/schemes/toric/morphism.py
    a b  
    748748                try:
    749749                    d = ZZ(d)
    750750                except TypeError:
    751                     raise TypeError('The fan morphism cannot be written in homogeneous polynomials.')
     751                    raise TypeError('The fan morphism cannot be written in '
     752                                    'homogeneous polynomials.')
    752753                polys[i] *= x**d
    753754        return SchemeMorphism_polynomial_toric_variety(self.parent(), polys)
    754755
     
    836837        return self.fan_morphism().is_surjective()
    837838
    838839    @cached_method
    839     def fiber(self):
     840    def fiber_generic(self):
    840841        """
    841         Return a connected component of the generic fiber of the
    842         morphism.
     842        Return the generic fiber of ``self``.
    843843       
    844         Note that the fiber of a toric morphism is constant over the
    845         maximal torus, so it makes sense to talk about the "generic"
    846         fiber even if the morphism is not surjective. This method
    847         returns the fiber over the base point with homogeneous
    848         coordinates `[1:1:\cdots:1]`.
     844        OUTPUT:
     845       
     846        - a :class:`toric variety <sage.toric.variety.ToricVariety_field>`.
     847       
     848        This method returns the fiber over the base point with homogeneous
     849        coordinates `[1:1:\cdots:1]`. Note that fibers of a toric morphism are
     850        isomorphic over the maximal torus of its image (which can have smaller
     851        dimension than it codomain), so it makes sense to talk about "the
     852        generic" fiber.
    849853
    850         The embedding of the generic fiber is a toric morphism. By
    851         contrast, the embedding of the fiber over lower-dimensional
    852         torus orbits of the codomain is not a toric morphism. Use
     854        The embedding of the generic fiber is a toric morphism with the
     855        :meth:`~sage.geometry.fan_morphism.FanMorphism.domain_fan` being the
     856        :meth:`kernel_fan` of ``self``. By contrast, embedding of fibers over
     857        lower-dimensional torus orbits of the image are not toric morphism. Use
    853858        :meth:`fiber_component` for the latter (non-generic) fibers.
    854859
    855860        EXAMPLES::
    856861
    857862            sage: P1xP1 = toric_varieties.P1xP1()
    858863            sage: P1 = toric_varieties.P1()
    859             sage: fiber = P1xP1.hom(matrix([[1],[0]]), P1).fiber()
     864            sage: fiber = P1xP1.hom(matrix([[1],[0]]), P1).fiber_generic()
    860865            sage: fiber
    861866            1-d toric variety covered by 2 affine patches
    862867            sage: f = fiber.embedding_morphism();  f
     
    873878                    [1 : 1 : z0 : z1]
    874879
    875880            sage: A1 = toric_varieties.A1()
    876             sage: fan = Fan([(0,1,2)], [(1,1,0),(1,0,1),(1,-1,-1)]).subdivide(new_rays=[(1,0,0)])
     881            sage: fan = Fan([(0,1,2)], [(1,1,0),(1,0,1),(1,-1,-1)])
     882            sage: fan = fan.subdivide(new_rays=[(1,0,0)])
    877883            sage: f = ToricVariety(fan).hom(matrix([[1],[0],[0]]), A1)
    878             sage: f.fiber()
     884            sage: f.fiber_generic()
    879885            2-d affine toric variety
    880             sage: f.fiber().fan().cones()
     886            sage: _.fan().cones()
    881887            ((0-d cone of Rational polyhedral fan in 2-d lattice N,),)
    882888        """
    883889        from sage.schemes.toric.variety import ToricVariety
     
    901907        fiber = ToricVariety(fiber_fan)
    902908
    903909        from sage.geometry.fan_morphism import FanMorphism
    904         fan_embedding = FanMorphism(K.echelonized_basis_matrix(), fiber_fan, self.domain().fan())
     910        fan_embedding = FanMorphism(K.echelonized_basis_matrix(), fiber_fan,
     911                                    self.domain().fan())
    905912        homset = fiber.Hom(self.domain())
    906913        embedding = SchemeMorphism_fan_toric_variety(homset, fan_embedding)
    907914        fiber._embedding_morphism = embedding
     
    911918        r"""
    912919        Return the torus orbit closure in the fiber corresponding to
    913920        ``domain_cone``.
     921       
     922        INPUT:
     923       
     924        - ``domain_cone`` -- a cone of the domain fan of ``self``.
     925       
     926        OUTPUT:
     927       
     928        - a :class:`toric variety
     929          <sage.schemes.toric.variety.ToricVariety_field>` with the embedding
     930          morphism into domain of ``self``.
     931         
     932        Let `\phi: Sigma \to \Sigma'` be the :meth:`fan morphism` corresponding
     933        to ``self``. Let `\sigma \in \Sigma` and `\sigma' \in \Sigma'` be the
     934        :meth:`~sage.geometry.fan_morphism.FanMorphism.image_cone` of `\sigma`.
     935        The fiber over a generic point corresponding to `\sigma'` is a union of
     936        toric varieties intersecting along their torus invariant subvarieties.
    914937
    915938        EXAMPLES::
    916939       
    917             sage: polytope = Polyhedron(
     940            sage: polytope = LatticePolytope(
    918941            ...       [(-3,0,-1,-1),(-1,2,-1,-1),(0,-1,0,0),(0,0,0,1),(0,0,1,0),
    919942            ...        (0,1,0,0),(0,2,-1,-1),(1,0,0,0),(2,0,-1,-1)])
    920             sage: coarse_fan = FaceFan(polytope.lattice_polytope())
     943            sage: coarse_fan = FaceFan(polytope)
    921944            sage: P2 = toric_varieties.P2()
    922945            sage: proj24 = matrix([[0,0],[1,0],[0,0],[0,1]])
    923946            sage: fm = FanMorphism(proj24, coarse_fan, P2.fan(), subdivide=True)
     
    933956            2-d toric variety covered by 3 affine patches
    934957            2-d toric variety covered by 3 affine patches
    935958        """
     959        domain_cone = self.domain().fan().embed(domain_cone)
    936960        if domain_cone.is_trivial():
    937             return self.fiber()
    938         embedding = SchemeMorphism_fan_fiber_toric_variety(self.domain(), self.fan_morphism(), domain_cone)
     961            return self.fiber_generic()
     962        embedding = SchemeMorphism_fan_fiber_toric_variety(
     963                                self.domain(), self.fan_morphism(), domain_cone)
    939964        return embedding.domain()
    940965
    941966    @cached_method
     
    970995           
    971996        This corresponds to the three different fibers::
    972997       
    973             sage: blowup.fiber()
     998            sage: blowup.fiber_generic()
    974999            0-d affine toric variety
    9751000            sage: blowup.fiber_component(Cone([(1,0)]))
    9761001            0-d affine toric variety
     
    12641289            sage: A2_Z2 = toric_varieties.A2_Z2()
    12651290            sage: O2_P1 = A2_Z2.resolve(new_rays=[(1,1)])
    12661291            sage: blowup = O2_P1.hom(identity_matrix(2), A2_Z2)
    1267             sage: blowup.fiber()
     1292            sage: blowup.fiber_generic()
    12681293            0-d affine toric variety
    12691294            sage: blowup.fiber_component(Cone([(1,0)]))
    12701295            0-d affine toric variety