unlisted
ubuntu2004o
��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 ]}| | |kr"||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 |dkr| ggS g }t | �D ]}t| t|� |d �D ]}|�t|�g| � q,q|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 sD t ���g }g }g }tt���D ]��� dk s �� � dkr&|��� q|��� qt�fdd�|D ��}t| d �D �]�}t| | �D �]Ӊ t� �� � fdd�� D �}tj|� D �]�} ||gg�d}
tt� ��D ]-�tt| � ��D ]"��� �� �fdd�t| � � �D �7 �|
| � � �d 7 }
quqkt |�D �]z�|dkr�|
t|� t�� dkr�q�t�fdd��D ��}��
|| �s�q��fd d�|D �}|| � d|
d| d }
t���t|
t��d �D �],}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 <