Ejemplo n.º 1
0
    def __init__(self, X, Y, category=None, check=True, base=ZZ):
        """
        The Python constructor.

        INPUT:

        The same as for any homset, see
        :mod:`~sage.categories.homset`.

        EXAMPLES::

            sage: P1xP1 = toric_varieties.P1xP1()
            sage: P1 = toric_varieties.P1()
            sage: hom_set = P1xP1.Hom(P1);  hom_set
            Set of morphisms
              From: 2-d CPR-Fano toric variety covered by 4 affine patches
              To:   1-d CPR-Fano toric variety covered by 2 affine patches

        An integral matrix defines a fan morphism, since we think of
        the matrix as a linear map on the toric lattice. This is why
        we need to ``register_conversion`` in the constructor
        below. The result is::

            sage: hom_set(matrix([[1],[0]]))
            Scheme morphism:
              From: 2-d CPR-Fano toric variety covered by 4 affine patches
              To:   1-d CPR-Fano toric variety covered by 2 affine patches
              Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
                    to Rational polyhedral fan in 1-d lattice N.
        """
        SchemeHomset_generic.__init__(self, X, Y, category=category, check=check, base=base)
        from sage.schemes.toric.variety import is_ToricVariety
        if is_ToricVariety(X) and is_ToricVariety(Y):
            self.register_conversion(MatrixSpace(ZZ, X.fan().dim(), Y.fan().dim()))
Ejemplo n.º 2
0
    def __init__(self, X, Y, category=None, check=True, base=ZZ):
        """
        The Python constructor.

        INPUT:

        The same as for any homset, see
        :mod:`~sage.categories.homset`.

        EXAMPLES::

            sage: P1xP1 = toric_varieties.P1xP1()
            sage: P1 = toric_varieties.P1()
            sage: hom_set = P1xP1.Hom(P1);  hom_set
            Set of morphisms
              From: 2-d CPR-Fano toric variety covered by 4 affine patches
              To:   1-d CPR-Fano toric variety covered by 2 affine patches

        An integral matrix defines a fan morphism, since we think of
        the matrix as a linear map on the toric lattice. This is why
        we need to ``register_conversion`` in the constructor
        below. The result is::

            sage: hom_set(matrix([[1],[0]]))
            Scheme morphism:
              From: 2-d CPR-Fano toric variety covered by 4 affine patches
              To:   1-d CPR-Fano toric variety covered by 2 affine patches
              Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
                    to Rational polyhedral fan in 1-d lattice N.
        """
        SchemeHomset_generic.__init__(self, X, Y, category=category, check=check, base=base)
        from sage.schemes.toric.variety import is_ToricVariety
        if is_ToricVariety(X) and is_ToricVariety(Y):
            self.register_conversion(MatrixSpace(ZZ, X.fan().dim(), Y.fan().dim()))
Ejemplo n.º 3
0
    def create_key_and_extra_args(self, toric_variety, base_ring=ZZ, check=True):
        """
        Create a key that uniquely determines the :class:`ChowGroup_class`.

        INPUT:

        - ``toric_variety`` -- a toric variety.

        - ``base_ring`` -- either `\ZZ` (default) or `\QQ`. The
          coefficient ring of the Chow group.

        - ``check`` -- boolean (default: ``True``).

        EXAMPLES::

            sage: from sage.schemes.toric.chow_group import *
            sage: P2 = toric_varieties.P2()
            sage: ChowGroup(P2, ZZ, check=True) == ChowGroup(P2, ZZ, check=False)   # indirect doctest
            True
        """
        if not is_ToricVariety(toric_variety):
            raise ValueError, 'First argument must be a toric variety.'

        if not base_ring in [ZZ,QQ]:
            raise ValueError, 'Base ring must be either ZZ or QQ.'

        key = tuple([toric_variety, base_ring])
        extra = {'check':check}
        return key, extra
Ejemplo n.º 4
0
def TrivialBundle(X, rank=1):
    r"""
    Return the trivial bundle of rank ``r``.

    INPUT:

    - ``X`` -- a toric variety. The base space of the bundle.

    - ``rank`` -- the rank of the bundle.

    OUTPUT:

    The trivial bundle as a Klyachko bundle.

    EXAMPLES::

        sage: P2 = toric_varieties.P2()
        sage: from sage.schemes.toric.sheaf.constructor import TrivialBundle
        sage: I3 = TrivialBundle(P2, 3);  I3
        Rank 3 bundle on 2-d CPR-Fano toric variety covered by 3 affine patches.
        sage: I3.cohomology(weight=(0,0), dim=True)
        (3, 0, 0)
    """
    if not is_ToricVariety(X):
        raise ValueError('not a toric variety')
    from sage.modules.free_module import VectorSpace
    base_ring = X.base_ring()
    filtrations = dict(
        [ray, FilteredVectorSpace(rank, 0, base_ring=base_ring)]
        for ray in X.fan().rays())
    import klyachko
    return klyachko.Bundle(X, filtrations, check=True)
Ejemplo n.º 5
0
def TangentBundle(X):
    r"""
    Construct the tangent bundle of a toric variety.

    INPUT:

    - ``X`` -- a toric variety. The base space of the bundle.

    OUTPUT:

    The tangent bundle as a Klyachko bundle.

    EXAMPLES::

        sage: dP7 = toric_varieties.dP7()
        sage: from sage.schemes.toric.sheaf.constructor import TangentBundle
        sage: TangentBundle(dP7)
        Rank 2 bundle on 2-d CPR-Fano toric variety covered by 5 affine patches.
    """
    if not is_ToricVariety(X):
        raise ValueError('not a toric variety')
    base_ring = X.base_ring()
    fan = X.fan()
    filtrations = dict()
    from sage.modules.filtered_vector_space import FilteredVectorSpace
    for i, ray in enumerate(fan.rays()):
        F = FilteredVectorSpace(fan.rays(), {0: range(fan.nrays()), 1: [i]})
        filtrations[ray] = F
    import klyachko
    return klyachko.Bundle(X, filtrations, check=True)
Ejemplo n.º 6
0
def LineBundle(X, D):
    """
    Construct the rank-1 bundle `O(D)`.

    INPUT:

    - ``X`` -- a toric variety. The base space of the bundle.

    - ``D`` -- a toric divisor.

    OUTPUT:

    The line bundle `O(D)` as a Klyachko bundle of rank 1.

    EXAMPLES::

        sage: X = toric_varieties.dP8()
        sage: D = X.divisor(0)
        sage: from sage.schemes.toric.sheaf.constructor import LineBundle
        sage: O_D = LineBundle(X, D)
        sage: O_D.cohomology(dim=True, weight=(0,0))
        (1, 0, 0)
    """
    if not is_ToricVariety(X):
        raise ValueError('not a toric variety')
    from sage.modules.free_module import VectorSpace
    base_ring = X.base_ring()
    filtrations = dict([
        X.fan().ray(i),
        FilteredVectorSpace(1, D.function_value(i), base_ring=base_ring)
    ] for i in range(X.fan().nrays()))
    import klyachko
    return klyachko.Bundle(X, filtrations, check=True)
Ejemplo n.º 7
0
def TrivialBundle(X, rank=1):
    r"""
    Return the trivial bundle of rank ``r``.

    INPUT:

    - ``X`` -- a toric variety. The base space of the bundle.

    - ``rank`` -- the rank of the bundle.

    OUTPUT:

    The trivial bundle as a Klyachko bundle.

    EXAMPLES::

        sage: P2 = toric_varieties.P2()
        sage: from sage.schemes.toric.sheaf.constructor import TrivialBundle
        sage: I3 = TrivialBundle(P2, 3);  I3
        Rank 3 bundle on 2-d CPR-Fano toric variety covered by 3 affine patches.
        sage: I3.cohomology(weight=(0,0), dim=True)
        (3, 0, 0)
    """
    if not is_ToricVariety(X):
        raise ValueError('not a toric variety')
    from sage.modules.free_module import VectorSpace
    base_ring = X.base_ring()
    filtrations = dict([ray, FilteredVectorSpace(rank, 0, base_ring=base_ring)]
                       for ray in X.fan().rays())
    import klyachko
    return klyachko.Bundle(X, filtrations, check=True)
Ejemplo n.º 8
0
def TangentBundle(X):
    r"""
    Construct the tangent bundle of a toric variety.

    INPUT:

    - ``X`` -- a toric variety. The base space of the bundle.

    OUTPUT:

    The tangent bundle as a Klyachko bundle.

    EXAMPLES::

        sage: dP7 = toric_varieties.dP7()
        sage: from sage.schemes.toric.sheaf.constructor import TangentBundle
        sage: TangentBundle(dP7)
        Rank 2 bundle on 2-d CPR-Fano toric variety covered by 5 affine patches.
    """
    if not is_ToricVariety(X):
        raise ValueError('not a toric variety')
    base_ring = X.base_ring()
    fan = X.fan()
    filtrations = dict()
    from sage.modules.filtered_vector_space import FilteredVectorSpace
    for i, ray in enumerate(fan.rays()):
        F = FilteredVectorSpace(fan.rays(), {0:range(fan.nrays()), 1:[i]})
        filtrations[ray] = F
    import klyachko
    return klyachko.Bundle(X, filtrations, check=True)
Ejemplo n.º 9
0
def LineBundle(X, D):
    """
    Construct the rank-1 bundle `O(D)`.

    INPUT:

    - ``X`` -- a toric variety. The base space of the bundle.

    - ``D`` -- a toric divisor.

    OUTPUT:

    The line bundle `O(D)` as a Klyachko bundle of rank 1.

    EXAMPLES::

        sage: X = toric_varieties.dP8()
        sage: D = X.divisor(0)
        sage: from sage.schemes.toric.sheaf.constructor import LineBundle
        sage: O_D = LineBundle(X, D)
        sage: O_D.cohomology(dim=True, weight=(0,0))
        (1, 0, 0)
    """
    if not is_ToricVariety(X):
        raise ValueError('not a toric variety')
    from sage.modules.free_module import VectorSpace
    base_ring = X.base_ring()
    filtrations = dict([X.fan().ray(i),
                        FilteredVectorSpace(1, D.function_value(i), base_ring=base_ring)]
                       for i in range(X.fan().nrays()))
    import klyachko
    return klyachko.Bundle(X, filtrations, check=True)