-
Notifications
You must be signed in to change notification settings - Fork 0
/
E_6.py
197 lines (180 loc) · 7.99 KB
/
E_6.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# E_6
"""Extremal Values for Codimensions of Unstable Loci
Authors: Valdemar Tsanov, Yana Staneva
Date: Oct 1, 2021
Let X=G/B be the flag variety of a semisimple complex Lie group G, B being a fixed Borel subgroup.
We are interested in the description of the GIT-classes of ample line bundles on X w.r.t. a given reductive subgroup.
More specifically, we are interested in extremal values of the codimensions of unstable loci.
This script computes the extremal values for codimensions of unstable loci for one-paramater subgroups.
The one-parameter subgroups we have implemented here are:
- fundamental coweights
- the sum of the fundamental weights (or one half times the sum of the positive roots)
Type E_6
Python 3.9
"""
# Import packages, if unavailable, use command: pip3 install numpy
import numpy as np
import itertools
import pandas as pd
import tabulate
from tabulate import tabulate
# Import package for loop progress bar in console
import tqdm
from tqdm import tqdm
# Class to store computations
comp_list = []
class Computations:
def __init__(self, fund, h, length, weyl, scalar_product):
self.fund = fund
self.h = h
self.length = length
self.weyl = weyl
self.scalar_product = scalar_product
def __str__(self):
return "h: {}, fund: {}, length: {}, weyl: {}, scalar_product: {} ".format(self.h, self.fund, self.length, [int(s) for s in self.weyl if s.isdigit()], self.scalar_product)
def __getitem__(self, item):
return getattr(self, item)
# Function to store the fundamental weights in an nxn array
def fundamental(n):
fundamental = np.zeros(shape=(n-2,n))
fundamental[0] = np.array([0,0,0,0,0,-1,-1,1])
fundamental[1] = np.array([1,1,1,1,1,-1,-1,1])
fundamental[2] = np.array([-3,3,3,3,3,-5,-5,5])
fundamental[3] = np.array([0,0,1,1,1,-1,-1,1])
fundamental[4] = np.array([0,0,0,3,3,-2,-2,2])
fundamental[5] = np.array([0,0,0,0,3,-1,-1,1])
return fundamental
# Function to compute the vectors h
def h_vector(n):
funds = fundamental(n)
h = np.vstack([funds, [0,1,2,3,4,-4,-4,4]])
# print('h_array = %s' % h )
return h
# Function to represent the simple reflections in matrix form
def matrix_form(elt):
elts = list(elt)
reflections = elts[1::3]
matrixform = np.eye(n)
for elt in reflections:
a = int(elt)
mat = np.eye(n)
if a == 1:
mat = -1*np.ones((n,n))
mat[a-1, ::-1] = 1
mat[:, a-1] = 1
mat[n-1, :] = 1
mat[:, n-1] = 1
mat[a-1, n-1] = -1
mat[n-1, a-1] = -1
np.fill_diagonal(mat, 3)
matrixform = np.dot(0.25*matrixform, mat)
elif a == 2:
mat[a-1, a-2] = -1
mat[a-2, a-1] = -1
mat[a-2, a-2] = 0
mat[a-1, a-1] = 0
matrixform = np.dot(matrixform, mat)
elif a == 8:
mat[a-2, a-2] = 0
mat[a-3, a-2] = 1
mat[a-2, a-3] = 1
mat[a-3, a-3] = 0
matrixform = np.dot(matrixform, mat)
else:
mat[a-2, a-2] = 0
mat[a-3, a-2] = 1
mat[a-2, a-3] = 1
mat[a-3, a-3] = 0
matrixform = np.dot(matrixform, mat)
return matrixform
# Initialize two lists, one for the generating symbolic reflections (r_1,r_2,...,r_j,...,r_n),
# one for the tuples of reflections, i.e. w = r_1*r_2*...*r_j.
# To reduce complexity, comment in or out the lines which generate the n-tuples of reflections needed
generators = []
all_possible_roots = []
# Function to generate reflections
def generate_reflections(n):
for i in range(1, n+1):
generators.append("r"+str(i))
# all_possible_roots.extend(generators)
# for subset in itertools.product(generators, generators):
# all_possible_roots.append('*'.join(subset))
# for subset in itertools.product(generators, generators, generators):
# all_possible_roots.append('*'.join(subset))
for subset in itertools.product(generators, generators, generators, generators):
all_possible_roots.append('*'.join(subset))
# for subset in itertools.product(generators, generators, generators, generators, generators):
# all_possible_roots.append('*'.join(subset))
# for subset in itertools.product(generators, generators, generators, generators, generators, generators):
# all_possible_roots.append('*'.join(subset))
# for subset in itertools.product(generators, generators, generators, generators, generators, generators, generators):
# all_possible_roots.append('*'.join(subset))
# for subset in itertools.product(generators, generators, generators, generators, generators, generators, generators, generators):
# all_possible_roots.append('*'.join(subset))
# for subset in itertools.product(generators, generators, generators, generators, generators, generators, generators, generators, generators):
# all_possible_roots.append('*'.join(subset))
# for subset in itertools.product(generators, generators, generators, generators, generators, generators, generators, generators, generators, generators):
# all_possible_roots.append('*'.join(subset))
# for subset in itertools.product(generators, generators, generators, generators, generators, generators, generators, generators, generators, generators, generators):
# all_possible_roots.append('*'.join(subset))
return(all_possible_roots)
# Function to print results in LaTeX table
def latex_with_lines(df, *args, **kwargs):
kwargs['column_format'] = '|'.join([''] + ['l'] * df.index.nlevels
+ ['r'] * df.shape[1] + [''])
kwargs['index'] = False
res = df.to_latex(*args, **kwargs)
return res.replace('\\\\\n', '\\\\ \\hline\n')
# Main function to test all fundamental weights
if __name__ == "__main__":
n = 8
fund = fundamental(n)
generators = generate_reflections(n-2)
h_vectors = h_vector(n)
nonzero_reflections = []
nonzero_reflections_matrix_form = []
scalar = []
for i in tqdm(generators):
a = matrix_form(i)
nonzero_reflections.append(i)
nonzero_reflections_matrix_form.append(a)
for j in range(len(fund)):
weyl_acting_fund = np.dot(a, fund[j])
for h in fund:
scalar_prod = np.dot(weyl_acting_fund, h)
if scalar_prod<0:
scalar.append(scalar_prod)
temp_permutation = Computations(fund[j], np.ravel(h), i.count("r"), i, scalar_prod)
comp_list.append(temp_permutation)
# for item in comp_list:
# print(item)
df = pd.DataFrame({'h': x.h.astype(int), '\varpi': x.fund.astype(int), 'Length': x.length, 'Scalar': x.scalar_product, 'Weyl': [int(s) for s in x.weyl if s.isdigit()]} for x in comp_list)
df_to_print = latex_with_lines(df)
print(df_to_print)
pass
# # Main function to test specific fundamental weight
# if __name__ == "__main__":
# n = 8
# fund = np.array([0,0,0,0,1,-1,-1,1])
# generators = generate_reflections(n-2)
# h_vectors = h_vector(n)
# nonzero_reflections = []
# nonzero_reflections_matrix_form = []
# scalar = []
# for i in tqdm(generators):
# a = matrix_form(i)
# nonzero_reflections.append(i)
# nonzero_reflections_matrix_form.append(a)
# weyl_acting_fund = np.dot(a, fund)
# for h in h_vectors:
# scalar_prod = np.dot(weyl_acting_fund, h)
# if scalar_prod<0:
# scalar.append(scalar_prod)
# temp_permutation = Computations(fund, np.ravel(h), i.count("r"), i, scalar_prod)
# comp_list.append(temp_permutation)
# # for item in comp_list:
# # print(item)
# df = pd.DataFrame({'h': x.h.astype(int), '\varpi': x.fund.astype(int), 'Length': x.length, 'Scalar': x.scalar_product, 'Weyl': [int(s) for s in x.weyl if s.isdigit()]} for x in comp_list)
# df_to_print = latex_with_lines(df)
# print(df_to_print)
# pass