Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
181 views
unlisted
ubuntu2004
a

��c4k�@sHdZddlZddlmZmZmZmZmZmZm	Z	ddlm
Z
mZmZddl
mZmZddlmZddlmZdd	lmZdd
lmZmZmZddlmZmZdd
�Zdd�Zdd�Zd2dd�Z d3dd�Z!d4dd�Z"dd�Z#dd�Z$d5dd�Z%dd�Z&d d!�Z'd"d#�Z(d$d%�Z)d6d&d'�Z*d7d(d)�Z+d*d+�Z,d,d-�Z-d8d.d/�Z.d9d0d1�Z/dS):a�
Chern character of the derived pushforward of a line bundle `\O(D)` on
the universal curve C_{g,n} over the space Mbar_{g,n} of stable curves via
the Grothendieck-Riemann-Roch (GRR) formula.

The algorithm implemented is the formula of Theorem 1 from the paper [PRvZ20]_ of
Pagani, Ricolfi and van Zelm. The formula itself is in the function
``generalized_hodge_chern(l,d,a,dmax,g,n)`` where using the notation from [PRvZ20]_:

- ``l`` is the integer l from equation (0.1)
- ``d`` is a list [d_1,...,d_n]
- ``a`` is a list of triples [h,S,a_{h,S}], where h is an integer and S a list
  so that [h,S] indicates the graph with two vertices and one edge with genus h
  on the left and markings S on the left. The integer a_{h,S} is the
  corresponding value to this graph from equation (0.1). Only the graphs with
  nonzero a_{h,S} need to be entered.

- ``dmax`` is the maximal codim to which we want to compute the formula of Theorem 1.
- ``g`` and ``n`` are respectively the genus and the number of marked points

As described in the paper [PRvZ20]_ this can be used to compute the DR cycle in
certain cases (namely when (d=[0,...,\pm 1,...,\mp 1,...,0]). The DR cycle can
be computed directly in this case by

    DR_phi(g,d)

The DR cycle can also be computed using [JPPZ17]_. This method has already been
implemented in admcycles.sage as DR_cycle(g,d). To verify that the methods give
the same result modulo Pixton relations one can type:

    (DR_phi(g,d) - DR_cycle(g,d)).is_zero()

We verified that these classes are the same for d=[1,-1] and g=1,2,3,4. For
higher values of g the computation takes too long. Note that in the case of
g=4 these are codimension 4 classes. The ring R^4(M_4,2) is generated by 3990
distinct decorated stratum classes, so this is a serious check on the
correctness of these formula's. Note also that the two methods do not give the
same result if we do not mod out by Pixton relations. i.e.

    (DR_phi(g,d) - DR_cycle(g,d)).simplify()

is not zero.
�N�)�	tautclass�
decstratum�stgraph�psicl�kappacl�psiclass�
kappaclass)�chern_char_to_poly�chern_char_to_class�	fundclass)�ZZ�QQ)�matrix)�powerset)�prod)�	bernoulli�binomial�multinomial)�bernoulli_polynomial�IntegerVectorscCst|�t|���S)z�
    Return Bernoulli number  of index ``n`` divided by ``n!``.

    EXAMPLES::

        sage: from admcycles import *
        sage: from admcycles.GRRcomp import *
        sage: divided_bernoulli(12)
        -691/1307674368000
    )rr
�	factorial��n�r�5/home/user/Introduction lectures/admcycles/GRRcomp.py�divided_bernoulli:srcCst||�t|���S)a7
    Return Bernoulli polynomial of index ``n`` at ``l``, divided by ``n!``.

    EXAMPLES::

        sage: from admcycles import *
        sage: from admcycles.GRRcomp import *
        sage: x = polygen(QQ,'x')
        sage: divided_bernoulli_polynomial(x,4)
        1/24*x^4 - 1/12*x^3 + 1/24*x^2 - 1/720
    )rr
r)�lrrrr�divided_bernoulli_polynomialHsrcCs0|durddlm}|dur(ddlm}||fS)a
    Helper function that fetches the global ``g`` and ``n`` parameters.

    See also :func:`admcycles.reset_g_n`.

    The global ``g`` and ``n`` should rather be replaced by the creation
    of an object ``MMbar(g, n)`` with attributes ``g`` and ``n``.
    Nr)�gr)�	admcyclesrr�rrrrr�
handle_g_nWs
	r"csNt���\��|dur&d�d�}t�����fdd�td|d�D��S)a

    Computes the Chern character of the derived pushforward of a line bundle \O(D) on
    the universal curve C_{g,n} over the space Mbar_{g,n} of stable curves.

    A divisor D on C_{g,n} up to pullbacks from Mbar_{g,n} takes the form

      D = l \tilde{K} + sum_{i=1}^n d_i \sigma_i  +  \sum_{h,S} a_{h,S} C_{h,S}

    where the numbers l, d_i and a_{h,S} are integers, \tilde{K} is the relative canonical
    class of the morphism C_{g,n} -> Mbar_{g,n}, \sigma_i is the image of the ith section
    and C_{h,S} is the boundary divisor of C_{g,n} where the moving point lies on a genus h
    component with markings given by the set S.
    For such a divisor this function computes the Chern character

      ch(R^\bullet \pi_* \O(D))

    up to codimension dmax using the formula given in [PRvZ20]_.

    NOTE: This formula assumes that the number n of marked points is at least 1.

    INPUT:

    l : integer
      the coefficient in front of \tilde{K}
    d : list
      vector of integers (d_1,...,d_n)
    a : list
      list of triples [h,S,a_{h,S}] where a_{h,S} is nonzero (and S is a subset of [1,...,n] )
    dmax : integer
      maximum codimension, set to 3g+3-n by default
    g : integer
      genus
    n : integer
      number of markings, for the formula to be correct we need at least one

    EXAMPLES::

      sage: from admcycles import *
      sage: from admcycles.GRRcomp import *
      sage: g=1;n=2
      sage: l=0;d=[1,-1];a=[[1,[],-1]]
      sage: generalized_hodge_chern(l,d,a,1,g,n)
      Graph :      [1] [[1, 2]] []
      Polynomial : 1/12*(kappa_1)_0 - 13/12*psi_1 - 1/12*psi_2
      <BLANKLINE>
      Graph :      [0] [[4, 5, 1, 2]] [(4, 5)]
      Polynomial : 1/24
      <BLANKLINE>
      Graph :      [0, 1] [[1, 2, 4], [5]] [(4, 5)]
      Polynomial : -11/12
    N�c3s |]}t|������VqdS�N��generalized_hodge_chern_single��.0�t��a�drrrrr�	<genexpr>��z*generalized_hodge_chern.<locals>.<genexpr>r)r"�sum�range)rr,r+�dmaxrrrr*r�generalized_hodge_cherngs4r2cCsxt||�\}}|dkrtd��|jt�dd�d�t|||||�t||||||�t||||�}|�|�}|�	�|S)a�
    Computes the degree t part of the Chern character of the derived pushforward of a line
    bundle \O(D) on the universal curve C_{g,n} over the space Mbar_{g,n} of stable curves.

    A divisor D on C_{g,n} up to pullbacks from Mbar_{g,n} takes the form

      D = l \tilde{K} + sum_{i=1}^n d_i \sigma_i  +  \sum_{h,S} a_{h,S} C_{h,S}

    where the numbers l, d_i and a_{h,S} are integers, \tilde{K} is the relative canonical
    class of the morphism C_{g,n} -> Mbar_{g,n}, \sigma_i is the image of the ith section
    and C_{h,S} is the boundary divisor of C_{g,n} where the moving point lies on a genus h
    component with markings given by the set S.
    For such a divisor this function computes the degree t part

      ch_t(R^\bullet \pi_* \O(D))

    of the Chern character of R^\bullet \pi_* \O(D) using the formula given in
    [PRvZ20]_.

    NOTE: This formula assumes that the number n of marked points is at least 1.

    EXAMPLES::

        sage: from admcycles import *
        sage: from admcycles.GRRcomp import *
        sage: l=0; d=[1,-1]; a=[[1,[],-1]]
        sage: generalized_hodge_chern_single(1, l, d, a, 1, 2)
        Graph :      [1] [[1, 2]] []
        Polynomial : 1/12*(kappa_1)_0 - 13/12*psi_1 - 1/12*psi_2
        <BLANKLINE>
        Graph :      [0] [[4, 5, 1, 2]] [(4, 5)]
        Polynomial : 1/24
        <BLANKLINE>
        Graph :      [0, 1] [[1, 2, 4], [5]] [(4, 5)]
        Polynomial : -11/12

    TESTS::

        sage: reset_g_n(1, 2)
        doctest:...: DeprecationWarning: reset_g_n is deprecated. Please use TautologicalRing instead.
        See https://gitlab.com/modulispaces/admcycles/-/merge_requests/109 for details.
        sage: generalized_hodge_chern_single(1, l, d, a)
        Graph :      [1] [[1, 2]] []
        Polynomial : 1/12*(kappa_1)_0 - 13/12*psi_1 - 1/12*psi_2
        <BLANKLINE>
        Graph :      [0] [[4, 5, 1, 2]] [(4, 5)]
        Polynomial : 1/24
        <BLANKLINE>
        Graph :      [0, 1] [[1, 2, 4], [5]] [(4, 5)]
        Polynomial : -11/12
    rzVThere needs to be at least one marked point for generalized_hodge_chern_single to workr���key)
r"�
ValueError�sort�operator�
itemgetter�generalized_hodge_chern_K�generalized_hodge_chern_S�todd_inv_exp�degree_part�simplify�r)rr,r+rr�resultrrrr&�s4��
r&c
Cs�t||�\}}|jt�dd�d�tg||�}td|d�D]p}t|d�t||���}t	||t
|��D]<}||tdd�t||�D��t
|�t|||||�7}qlq:|t|||�7}|S)a-
    EXAMPLES::

      sage: from admcycles import *
      sage: from admcycles.GRRcomp import *
      sage: todd_inv_exp([],1,1,2)
      Graph :      [0] [[4, 5, 1, 2]] [(4, 5)]
      Polynomial : 1/24
      <BLANKLINE>
      Graph :      [0, 1] [[1, 2, 4], [5]] [(4, 5)]
      Polynomial : 1/12
    rr3r4css|]\}}|d|VqdS)r3Nr)r(�aiZtvectirrrr-�r.ztodd_inv_exp.<locals>.<genexpr>)r"r7r8r9rr0rr
rr�lenr�zipr�todd_inv_exp_graphs�todd_inv_sigma)r+r)rrr@�t1Zcoeff_t1�tvectrrrr<�s
��
r<c	s�ddkrtg���S�dkr>��fdd�t�d�D�}ndd�td�dd�D�}t��fdd�t��D���ttt�dgttd�d	��g�d�dfg��d
�g���}t���fdd�|D��}t�d�td�||}|���}|�	�|S)
Nr3rcsVg|]N}ttd�d��D]6}|dkr*|r|�krBt|��dks|dg|g�qqS)r3rrr#�rr0rB�r(�h�sr!rr�
<listcomp>s$�z"todd_inv_sigma.<locals>.<listcomp>rcSsg|]}|gg�qSrr)r(rJrrrrLr.c3sD|]<}t�d�d�|t�d�d��d|VqdS)rr3N�r�r(�i)rr)rrr-r.z!todd_inv_sigma.<locals>.<genexpr>r#��polyc3s�|]|}ttt|d�|dg|d�dgtttd�d��t|d���dgg�d�dfg��d�g���VqdS)rrr3rPN)rrr�list�setr0)r(�ahS)�decsumrrrrr-
s�<������rr3)
rr0r/rrrRrrr=r>)r)rr�seprangeZ
tautclass1Z
tautclass2r@r)rUrrr)rrE�s( ����
rEc	sdd�|D��dd�t||�D��t���dt|��}t�fdd�t�d�D���rttttd�d��t�dd���}t�dd|d�D�]}|D�]}|�ddkr�|�rV||kr�t�dd�t|�d	k�sV�ddg�fd
d�td��D�|�ddg||g}	�dd�dgg��fdd�td��D�tt|�t�dd���d	��d	�dggtttd�d��t�dd�t|���d	�d	gg}
�fdd�t�d�D�}t|	|
|�}t	���fd
d�t��D�t
���fdd�t��D��g�}
|tt||
d�g|��7}|�ddkr�|s��ddg�fdd�td��D�|�ddg}	�dd�dgg��fdd�td��D�tttd�d��t�dd���d	�gg}
�fdd�t��D�}t|	|
|�}t	���fdd�t�d�D�t
�d	�d�d	���dgt
���fdd�t��D��g�}
|tt||
d�g|��7}q�q�|�dddk�r�ddg�fdd�td��D�|�dddg}	�dd�dgg��fdd�td��D�tttd�d��t�dd���d	��d	�d�d	�d	gg}
�fdd�t�d�D�}t|	|
|�}t	���fdd�t��D�t
���fdd�t��D��g�}
|td�tt||
d�g|��7}|S)a
    TESTS:

    We check that https://gitlab.com/modulispaces/admcycles/-/merge_requests/149 does not reappear::

        sage: from admcycles.GRRcomp import todd_inv_exp_graphs
        sage: len(todd_inv_exp_graphs([[1, [1], -1]], 1, [1], 3, 2)._terms) == 5
        True
    cSsg|]}|dkr|�qS�rr�r(�tvirrrrL r.z'todd_inv_exp_graphs.<locals>.<listcomp>cSsg|]\}}|dkr|�qSrXr�r(rArZrrrrL!r.rc3sF|]>}�|d�|ddko<�|d�|ddkVqdS�rrNrrN��atnrrr-$s�z&todd_inv_exp_graphs.<locals>.<genexpr>r�����r3cs(g|] }�|d�|dd�qS�rrrrNr]rrrL/s�csPg|]H}tt�|d�t�|dd���d|�d|dg�qSrV�rRrSrN�r^rrrrL1r.cs,g|]$}�d|d�d|df�qS�r3rrrNrrrrL3r.cs0g|](�t����fdd�t���D���qS)cs�g|]~}t��d|�d��dt�d�d�d�d�|t�d�d�d�d���d|�qS�rr_r3�rr�r(�j��LrOr�tvnrrrL5r.�2todd_inv_exp_graphs.<locals>.<listcomp>.<listcomp>�r/r0�r(�rirrj�rOrrL5r.csbg|]Z}t�d�d�d�d�|t�d�d�d�d��d|�qSrcrMrf�rirrFrrrL6r.rPcs(g|] }�|d�|dd�qSr`rrNr]rrrL;r.csPg|]H}tt�|d�t�|dd���d|�d|dg�qSrVrarNrbrrrL<s�cs,g|]$}�d|d�d|df�qSrcrrNrrrrL>r.cs0g|](�t����fdd�t���D���qS)cs~g|]v}t��d|�d��dt�d�d�d��|t�d�d�d����d|�qSrdrerfrhrrrL@r.rkrlrmrnrorrL@s�csVg|]N}t�d�d�d��|t�d��d���d|�qSrcrMrfrprrrLAr.cs(g|] }�|d�|dd�qSr`rrNr]rrrLFr.csPg|]H}tt�|d�t�|dd���d|�d|dg�qSrVrarNrbrrrLGr.cs,g|]$}�d|d�d|df�qSrcrrNrrrrLIr.cs0g|](�t����fdd�t���D���qS)cs�g|]~}t��d|�d��dt�d�d�d�d�|t�d�d�d�d���d|�qSrdrerfrhrrrLKs�rkrlrmrnrorrLKs�
�csbg|]Z}t�d�d�d�d�|t�d�d�d�d��d|�qSrcrMrfrprrrLLr.rV)rCrBr�allr0rRrrSrrr/rrrr)r+rFrGrrr@ZSncrJ�S�vertices�labels�
involution�graph�psir)rir^rrFrjrrDs�
�
*
@���2��@��
8"�4�
�(��<$�P���"rDc	s�t|��\}�tg|��}t|dt|��D�]�}dd�|D��dd�t||�D��t���tttd�d��t�dd��}t�fdd�t�d�D��r,�ddkr,�ddg�fd	d�td��D�|�ddg}�dd�dgg��fd
d�td��D�|�d�gg}�fdd�t��D�}	t	|||	�}
t
����fd
d�t�d�D��dd�dd�ddt���fdd�t�dd�D��g�}|t��tt
|
|d�g|��7}q,t��t|d���|S)NrcSsg|]}|dkr|�qSrXrrYrrrrLYr.z/generalized_hodge_chern_exp.<locals>.<listcomp>cSsg|]\}}|dkr|�qSrXrr[rrrrLZr.r_c3sF|]>}�|d�|ddko<�|d�|ddkVqdSr\rrNr]rrr-]r.z.generalized_hodge_chern_exp.<locals>.<genexpr>rcs(g|] }�|d�|dd�qSr`rrNr]rrrL^r.csPg|]H}tt�|d�t�|dd���d|�d|dg�qSrVrarNrbrrrL_s�&�r3cs,g|]$}�d|d�d|df�qSrcrrNrrrrLar.csTg|]L���d��d��dt����fdd�t���D���qS)r3r_rcsng|]f}t��d|�t�d�d�d��|t�d�d�d����d|�qSrVrerfrhrrrLdr.z:generalized_hodge_chern_exp.<locals>.<listcomp>.<listcomp>rlrm�rir^rrjrorrLcs�""�csng|]f}t�dd|�t�d�d�d��|t�d��d���dd|d�qS)r_rr3rerfrnrrrLfr.rP)r"rrrBrCrRrSr0rqrrr/rrr
�oner)r)r+rrr@rG�Scomprsrtrurvrwrrxr�generalized_hodge_chern_expSs2&*8"��
�"$��$r{c	CsXtg||�}t|d�D]:}|d|}|t||�t|���t|||||�7}q|S)Nr3r)rr0rr
r�generalized_hodge_chern_Kin)r)rr+rrr@�alpha�betarrrr:ks�r:csrtg���}t|d�D]T�|d��td�d�D]4�|t��������fdd�t�d�D��7}q6q|S)Nrc	3sb|]Z}d|��d�|t�|�t����t�|���t�������VqdS)r_rN)rr
r�generalized_hodge_chern_Sin)r(�b�r+r}r~r,rrr�prrr-ys�0�
�z,generalized_hodge_chern_S.<locals>.<genexpr>)rr0r/r?rr�rr;ts
�r;cs�|dkr&t|���t|d||��S|dkr>t|d|��Stg|��}t|t|��D�]�}dd�|D��dd�t||�D��t���tt	t
d�d��t	�dd��}t�fdd�t
�d�D��rX�ddg�fd	d�t
d��D�|�ddg}�dd�dgg��fd
d�t
d��D�|�d�gg}	�fdd�t
��D�}
t||	|
�}t
����fd
d�t
��D��}t�|d�d|�ddt|�d�}
|t��tt||
|d�g|��7}qX|S)NrrcSsg|]}|dkr|�qSrXrrYrrrrL�r.z/generalized_hodge_chern_Kin.<locals>.<listcomp>cSsg|]\}}|dkr|�qSrXrr[rrrrL�r.r_c3sF|]>}�|d�|ddko<�|d�|ddkVqdSr\rrNr]rrr-�s�z.generalized_hodge_chern_Kin.<locals>.<genexpr>cs(g|] }�|d�|dd�qSr`rrNr]rrrL�r.csPg|]H}tt�|d�t�|dd���d|�d|dg�qSrVrarNrbrrrL�s�&�r3cs,g|]$}�d|d�d|df�qSrcrrNrrrrL�r.csTg|]L���d��d��dt����fdd�t���D���qS)r3r_rcsng|]f}t��d|�t�d�d�d��|t�d�d�d����d|�qSrVrerfrhrrrL�s�,�,�z:generalized_hodge_chern_Kin.<locals>.<listcomp>.<listcomp>rlrmrxrorrL�s�4
�rP)r
rr{r	rrrBrCrRrSr0rqrrrrr)r}r~r+rrr@rGrzrsrtrurvrw�kapparrxrr|~s6&
�8"���,(r|c	s�|dkr&t|���t|d||��S|dkrDt||��|dStg|��}t|t|��D�]�}dd�|D��dd�t||�D��t���tt	t
d�d��t	�dd��}t�fdd�t
�d�D��r^||vr^�ddg�fd	d�t
d��D�|�ddg}	�dd�dgg��fd
d�t
d��D�|�d�gg}
�fdd�t
��D�}t|	|
|�}t
����fd
d�t
��D�d|dt|�d��|dg�}
|t��tt||
d�g|��7}q^|S)NrrcSsg|]}|dkr|�qSrXrrYrrrrL�r.z/generalized_hodge_chern_Sin.<locals>.<listcomp>cSsg|]\}}|dkr|�qSrXrr[rrrrL�r.r_c3sF|]>}�|d�|ddko<�|d�|ddkVqdSr\rrNr]rrr-�s�z.generalized_hodge_chern_Sin.<locals>.<genexpr>cs(g|] }�|d�|dd�qSr`rrNr]rrrL�r.csPg|]H}tt�|d�t�|dd���d|�d|dg�qSrVrarNrbrrrL�s�&�r3cs,g|]$}�d|d�d|df�qSrcrrNrrrrL�r.csTg|]L���d��d��dt����fdd�t���D���qS)r3r_rcsng|]f}t��d|�t�d�d�d��|t�d�d�d����d|�qSrVrerfrhrrrL�s�8��
��z:generalized_hodge_chern_Sin.<locals>.<listcomp>.<listcomp>rlrmrxrorrL�s�4
�rP)r
rr{rrrrBrCrRrSr0rqrrrrr)r}r~r�r+rrr@rGrzrsrtrurvrwrrxrr�s<&
��8"���&�$rc	s�t���\����fdd�t�d�D�}g}|D]T\}}|d|dt|�dt�fdd�|D��}|dkr2|�|||g�q2|S)a
    INPUT:

    - l -- integer

    - d -- list of integers (d_1,...,d_n)

    EXAMPLES::

        sage: from admcycles import *
        sage: from admcycles.GRRcomp import *
        sage: twist_div_to_zero(3,[3,4],2,2)
        [[0, [1, 2], -10], [1, [1], -9], [1, [1, 2], -16]]
    c3sX|]P}ttd�d��D]8}|dks(|r|�ks@t|��dkr|dg|gVqqdS)r3rrr#NrHrIr!rrr-�s$�z$twist_div_to_zero.<locals>.<genexpr>rr3c3s|]}�|dVqdS)rNr)r(r�)r,rrr-�r.r)r"r0rBr/�append)	rr,rrrWr+ZhS0ZhS1rTr)r,rrr�twist_div_to_zero�s4r�csBt���\�������fdd�}t||����|�}|��|S)a�

    Computes the Chern class c_deg of the derived pushforward of a line
    bundle \O(D) on the universal curve C_{g,n} over the space Mbar_{g,n} of stable curves.

    A divisor D on C_{g,n} up to pullbacks from Mbar_{g,n} takes the form

      D = l \tilde{K} + sum_{i=1}^n d_i \sigma_i  +  \sum_{h,S} a_{h,S} C_{h,S}

    where the numbers l, d_i and a_{h,S} are integers, \tilde{K} is the relative canonical
    class of the morphism C_{g,n} -> Mbar_{g,n}, \sigma_i is the image of the ith section
    and C_{h,S} is the boundary divisor of C_{g,n} where the moving point lies on a genus h
    component with markings given by the set S.
    For such a divisor this function computes the Chern class

      c_deg(R^\bullet \pi_* \O(D))

    of the derived pushforward R^\bullet \pi_* \O(D) using the formula given in
    [PRvZ20]_. When l=1, d=[0,...,0] and a=[] this coincides with the lambda class.

    NOTE: This formula assumes that the number n of marked points is at least 1.

    INPUT:

    deg : integer
      degree of the chern class
    l : integer
      the coefficient in front of \tilde{K}
    d : list
      vector of integers (d_1,...,d_n)
    a : list
      list of triples [h,S,a_{h,S}] where a_{h,S} is nonzero (and S is a subset of [1,...,n] )
    g : integer
      genus
    n : integer
      number of markings, for the formula to work we need n > 0


    EXAMPLES::

        sage: from admcycles import *
        sage: from admcycles.GRRcomp import *
        sage: l = 1; d = [0]; a = []
        sage: t = generalized_lambda(1,l,d,a,2,1);t
        Graph :      [2] [[1]] []
        Polynomial : 1/12*(kappa_1)_0 - 1/12*psi_1
        <BLANKLINE>
        Graph :      [1] [[3, 4, 1]] [(3, 4)]
        Polynomial : 1/24
        <BLANKLINE>
        Graph :      [1, 1] [[3], [1, 4]] [(3, 4)]
        Polynomial : 1/12
        sage: t.basis_vector()
        (1/2, -1/2, -1/2)

    We can verify that this computes the lambda class when l=1, d=[0,...,0] and
    a=[]. We do this for lambda_2 in \barM_3,1::

        sage: from admcycles import *
        sage: from admcycles.GRRcomp import *
        sage: reset_g_n(3, 1)
        doctest:...: DeprecationWarning: reset_g_n is deprecated. Please use TautologicalRing instead.
        See https://gitlab.com/modulispaces/admcycles/-/merge_requests/109 for details.
        sage: l = 1; d = [0]; a = []
        sage: s = lambdaclass(2)
        doctest:...:     DeprecationWarning: Use of lambdaclass without specifying g,n is deprecated.
        See https://gitlab.com/modulispaces/admcycles/-/merge_requests/109 for details.
        sage: t = generalized_lambda(2, l, d, a)
        sage: (s-t).simplify()
        0
    cst|������Sr$r%)�mr*rr�chclasssz#generalized_lambda.<locals>.chclass)r"r
r=r>)�degrr,r+rrr��chpolyrr*r�generalized_lambda�s
Gr�c	Cs0t|�}td|||�}t|td|||||��S)aT
    Computes the double ramification cycle DR(g,d) in the case d=[0,...,\pm
    1,...,\mp 1,...,0] as described in the paper [PRvZ20]_.

    Input:

    g : integer
      the genus
    d : vector
      the vector d

    EXAMPLES::

        sage: from admcycles import *
        sage: from admcycles.GRRcomp import *
        sage: DR_phi(1, [1,-1])
        Graph :      [1] [[1, 2]] []
        Polynomial : -1/12*(kappa_1)_0 + 13/12*psi_1 + 1/12*psi_2
        <BLANKLINE>
        Graph :      [0] [[4, 5, 1, 2]] [(4, 5)]
        Polynomial : -1/24
        <BLANKLINE>
        Graph :      [0, 1] [[1, 2, 4], [5]] [(4, 5)]
        Polynomial : -1/12

    The different ways of computing the DR cycle coincide when d is of the form
    [0,...,\pm 1,...,\mp 1,...,0]::

        sage: from admcycles import *
        sage: from admcycles.GRRcomp import *
        sage: g = 2; d = [1,-1]
        sage: (DR_phi(g,d) - DR_cycle(g,d)).is_zero()
        True

    But not for other values of d::

        sage: from admcycles import *
        sage: from admcycles.GRRcomp import *
        sage: g = 1; d = [2,0]
        sage: (DR_phi(g,d)-DR_cycle(g,d)).FZsimplify()
        Graph :      [1] [[1, 2]] []
        Polynomial : -(kappa_1)_0 + 4*psi_1

    On the locus of compact type curves we have equality for all vectors d where
    the entries sum to 0.::

        sage: from admcycles import *
        sage: from admcycles.GRRcomp import *
        sage: g = 2; d = [2,-2]
        sage: (DR_cycle(g,d) - DR_phi(g,d)).basis_vector()
        (12, -4, 14, 7, -40, -10, -14, -12, 28, -4, 6, -1, 4, 0)
        sage: (DR_cycle(g,d) - DR_phi(g,d)).toTautbasis(moduli='ct')
        doctest:...: DeprecationWarning: toTautbasis is deprecated. Please use basis_vector instead.
        See https://gitlab.com/modulispaces/admcycles/-/merge_requests/109 for details.
        (0, 0, 0, 0, 0)
    r)rBr�rr2)rr,rr+rrr�DR_phis9r�csHt���td���������fdd�}t|�������}|��|S)a<
    Alternative to DR_phi using chern_char_to_poly, but this takes a lot longer, kept here
    only for testing purposes.

    TESTS::

      sage: from admcycles.GRRcomp import DR_phi, DR_phi1
      sage: D1 = DR_phi(2, [1, -1])
      sage: D2 = DR_phi1(2, [1, -1])
      sage: (D1 - D2).is_empty()
      True
    rcst|d�����}|��|S)Nr)r&r>)r��temp�r+r,rrrrr�kszDR_phi1.<locals>.chclass)rBr�r
r=r>)rr,r�r�rr�r�DR_phi1[s
r�csRt���\�����fdd�t|�d|��D��t��fdd�t��D��S)Ncsg|]}t|�����qSr)rr')�charrrrrrLwr.z,hodge_chern_class_matrix.<locals>.<listcomp>rcs&g|]����fdd�t��D��qS)cs g|]}�|�d��qS)rrrN)�crgr�rrrLxr.z7hodge_chern_class_matrix.<locals>.<listcomp>.<listcomp>)r0rm)r�r�)rgrrLxr.)r"r0r)r�r��qrrr)r�r�rrr�r�hodge_chern_class_matrixus(r�c
Cs\t||�\}}|d}|||}tg||�t|||||d||�}	t|	||||���S)Nr)r"rr2r��det)
�rr�rr,r+rrr�r�r�rrr�generalized_brill_noether_class{s
&r�)NNN)NN)NN)NN)NN)NN)NN)NN)0�__doc__r8r rrrrrrr	r
rr�sage.rings.allr
r�sage.matrix.constructorr�sage.misc.miscr�sage.misc.misc_cr�sage.arith.allrrr�sage.combinat.allrrrrr"r2r&r<rErDr{r:r;r|rr�r�r�r�r�r�rrrr�<module>s8+$
;
@
>
	


Q>