unlisted
ubuntu2004a
��c6� � @ s8 d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlm Z d dl
mZ d dlm
Z
d dlmZ d d lmZ d d
lmZ d dlmZmZ d dlmZ d d
lmZ d dlZd dlZd dlZd dlZd dlZd dl Zd dl!Zd dl"Zd dl#Zd dl$m%Z%m&Z&m'Z'm(Z( G dd� de�Z)G dd� de)�Z*G dd� de)�Z+dS )� N)�
partitions)�
SageObject)�matrix)�flatten)�
cached_method��QQ�� factorial)�WeightedIntegerVectors)�binomial)�pi�I)�prod)�deepcopy)�hash_AG�unite_embedded_graphs�adm_key�get_squished_levelc @ s� e Zd ZdZd�dd�Zdd� Zdd� Zd d
� Zdd� Zd�d
d�Z dd� Z
dd� Zedd� �Z
dd� Zdd� Zedd� �Zedd� �Zedd� �Zedd � �Zed!d"� �Zed#d$� �Zed%d&� �Zed'd(� �Zed)d*� �Zd+d,� Zed-d.� �Zed/d0� �Zed1d2� �Zd3d4� Zed�d6d7��Zed8d9� �Z d�d:d;�Z!ed�d<d=��Z"d�d>d?�Z#ed�d@dA��Z$ed�dBdC��Z%d�dDdE�Z&edFdG� �Z'edHdI� �Z(edJdK� �Z)ed�dLdM��Z*edNdO� �Z+edPdQ� �Z,edRdS� �Z-edTdU� �Z.edVdW� �Z/d�dYdZ�Z0d�d\d]�Z1ed�d_d`��Z2dadb� Z3dcdd� Z4ededf� �Z5dgdh� Z6didj� Z7ed�dkdl��Z8d�dmdn�Z9dodp� Z:d�dqdr�Z;dsdt� Z<d�dudv�Z=d�dwdx�Z>edydz� �Z?d�d{d|�Z@ed}d~� �ZAedd�� �ZBed�d�d���ZCd�d�d��ZDd�d�� ZEed�d�d���ZFed�d�� �ZGd�d�d��ZHed�d�� �ZIed�d�� �ZJed�d�� �ZKed�d�� �ZLd�d�� ZMed�d�d���ZNd�d�� ZOed�d�d���ZPed�d�� �ZQd�d�d��ZRd�d�d��ZSd�d�d��ZTd�d�d��ZUd�d�d��ZVd�d�d��ZWd�d�� ZXd�d�d��ZYd�d�d��ZZd�d�d��Z[d�d�d��Z\�d d�d��Z]�dd�d��Z^d�d�� Z_�dd�d��Z`�dd�d��Za�dd�dZb�dd�dĄZc�dd�dƄZdd�dȄ Zei d5d5d5fd�dʄZf�dd�d̄Zged�d΄ �Zhed�dЄ �Zied�d҄ �Zjed�dԄ �Zked�dք �Zl�dd�dZm�d d�dڄZnd�d܄ ZodS (
�GeneralisedStratumaF
A union of (meromorphic) strata with residue conditions.
A GeneralisedStratum is uniquely identified by the following information:
* sig_list : list of signatures [sig_1,...,sig_n], where sig_i is the Signature
of the component i,
* res_cond : list of residue conditions, i.e. [R_1,...,R_n] where each R_l is
a list of tuples (i,j), corresponding to the j-th component of sig_i, that
share a residue condition (i.e. the residues at these poles add up to 0).
Note that the residue theorem for each component will be added automatically.
Nc C s� t dd� |D ��sJ �t|�| _|| _tdd� |D ��| _dd� |D �| _dd� t|�D �| _t| j�| _ |d u rvg }|| _
| �� d S )Nc s s | ]}|j d kV qdS �� N��k��.0�sig� r �K/home/user/Introduction lectures/admcycles/diffstrata/generalisedstratum.py� <genexpr>� � z.GeneralisedStratum.__init__.<locals>.<genexpr>c S s g | ]
}|j �qS r ��nr r r r �
<listcomp>� r z/GeneralisedStratum.__init__.<locals>.<listcomp>c S s g | ]
}|j �qS r )�gr r r r r# � r c S s$ g | ]\}}|j D ]}||f�qqS r )Zpole_ind)r �ir �jr r r r# � s
�)�all�len�_h0� _sig_list�sum�_n�_g� enumerate� _polelist�_p� _res_cond� init_more)�self�sig_list�res_condr r r �__init__� s
zGeneralisedStratum.__init__c C s: d | _ d | _d | _d | _i | _d | _i | _d | _d | _d S �N) �_bics�
_smooth_LG�_all_graphs�_lookup_list�_lookup�_DG�_AGs�_ONE�_ZERO�r3 r r r r2 � s zGeneralisedStratum.init_morec C s d| j | jf S )Nz+GeneralisedStratum(sig_list=%r,res_cond=%r))r* r1 rA r r r �__repr__� s �zGeneralisedStratum.__repr__c C s| d}| j dkr|d7 }n|d7 }| jD ]}|t|j�d 7 }q&|d7 }| js\|tg �d 7 }| jD ]}|t|�d 7 }qb|S )N� r �Product of Strata:
� Stratum: �
�with residue conditions: )r) r* �reprr r1 �r3 �repr �resr r r �__str__� s
zGeneralisedStratum.__str__c C s� dd� }t | � t d| j � t d| �� � t d� d}t| j�D ].\}}t|�}t d||||�f � ||7 }qDt d| � d S )
a-
Print facts about self.
This calculates everything, so could take long(!)
EXAMPLES::
sage: from admcycles.diffstrata import *
sage: X=GeneralisedStratum([Signature((1,1))])
sage: X.info()
Stratum: (1, 1)
with residue conditions: []
Genus: [2]
Dimension: 4
Boundary Graphs (without horizontal edges):
Codimension 0: 1 graph
Codimension 1: 4 graphs
Codimension 2: 4 graphs
Codimension 3: 1 graph
Total graphs: 10
sage: X=GeneralisedStratum([Signature((4,))])
sage: X.info()
Stratum: (4,)
with residue conditions: []
Genus: [3]
Dimension: 5
Boundary Graphs (without horizontal edges):
Codimension 0: 1 graph
Codimension 1: 8 graphs
Codimension 2: 19 graphs
Codimension 3: 16 graphs
Codimension 4: 4 graphs
Total graphs: 48
c S s | dkrdS dS d S )Nr �graph�graphsr r! r r r �_graph_word� s z,GeneralisedStratum.info.<locals>._graph_wordz Genus: %sz
Dimension: %sz+Boundary Graphs (without horizontal edges):r zCodimension %s: %s %szTotal graphs: %sN)�printr- �dimr. �
all_graphsr( )r3 rO �tot�crN r"