unlisted
ubuntu2004a
��c�r � @ s d Z ddlmZ ddlmZ ddlZddlmZ ddlm Z ddl
mZ ddlm
Z
dd lmZ dd
lmZ ddlmZ ddlmZ d
dlmZ ddlmZ ddlZddlZddlZd
dlmZ dd� Z dd� Z!dd� Z"d"dd�Z#d#dd�Z$edd� �Z%d d!� Z&dS )$z� Recursive computation of strata of k-differentials
This is following the papers [FaPa18]_ by Farkas-Pandharipande and [Sch18]_ by Schmitt.
� )�Iterable)�deepcopyN)�subsets)�IntegerVectors��
Partitions)�prod)�ZZ)�cached_function)�Word��ceil� )�StableGraph)�DR_cycle)�TautologicalRingc C sl | sg S g }dg}| d }t dt| ��D ]4}| | |krD||g7 }q(||g7 }|g}| | }q(||g7 }|S )z�
INPUT:
- l -- a list
EXAMPLES::
sage: from admcycles.stratarecursion import classes
sage: classes([])
[]
sage: classes([4,4,3,3,3,1,1])
[[0, 1], [2, 3, 4], [5, 6]]
r r )�range�len)�l�indices�currentZcurrentitem�i� r �=/home/user/Introduction lectures/admcycles/stratarecursion.py�classes- s
r c C sx |dk rg S |dkr"| rg S g gS |dkr2| ggS g }t | �D ]4}t| t|� |d �D ]}|�t|�g| � qXq>|S )a�
Return a list of partitions of the set S into the disjoint union of s sets.
A partition is a list of sets.
EXAMPLES::
sage: from admcycles.stratarecursion import SetPart
sage: S = set(['b','o','f'])
sage: SetPart(S,2)
[[set(), {'b', 'f', 'o'}],
...
[{'b', 'f', 'o'}, set()]]
sage: SetPart(S,1)
[[{'b', 'f', 'o'}]]
sage: SetPart(S,-1)
[]
sage: SetPart(S,0)
[]
r r )r �SetPart�set�append)�S�s�resu�T�rr r r r K s r c sZ t ���g }g }g }tt���D ]6��� dk s@�� � dkrL|��� q |��� q t�fdd�|D ��}t| d �D �]�}t| | �D �]�� t� �� � fdd�� D �}tj|� D �]�} ||gg�d}
tt� ��D ]Z�tt| � ��D ]D��� �� �fdd�t| � � �D �7 �|
| � � �d 7 }
q�q�t |�D �]
�|dk�rh|
t|� t�� dk�rh�q:t�fdd��D ��}��
|| ��s��q:�fd d�|D �}|| � d|
d| d }
t���t|
t��d �D �]b}g }tt��d �D ]~�g }t|� t��d � t��d �d
�D ]<�����fdd�tt��d ��D �}|tj|� 7 }�q,|�|� �q�tj|� D �]�}t��}|d d �7 <