/
adaction.py
260 lines (219 loc) · 5.83 KB
/
adaction.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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
import numpy as np
import sympy as sp
class AdAction:
type = 0
constants = 0
# underlying Lie algebra
lie = 0
# underlying group
group = 0
# underlying roots
roots = 0
def __init__(self, t): # with_dist_expr=True,with_weyl_group=True):
self.type = t
self.lie = self.type.lie
self.roots = self.type.rootsystem
self.group = self.type.group
self.constants = self.type.constants
"""
Adjoint action of u_r on e_s
--- Carter p.61
--- !!! atentie, in Mrsi the index is shifted
"""
def ad_ue(self, u, e):
r = u[1]
mr = self.roots.minus_r(r)
if r == e[1]:
return [[e[0], e[1], e[2]]]
if mr == e[1]:
result = [[e[0], e[1], e[2]]]
result += [["h", r, u[2] * e[2]]]
result += [["e", r, -u[2] ** 2 * e[2]]]
return result
s = e[1]
Mrs = self.constants.M[r][s]
rr = self.roots.roots[r]
ss = self.roots.roots[s]
result = [["e", e[1], e[2]]]
for i in range(len(Mrs)):
irs = self.roots.index((i + 1) * rr + ss)
result.append(["e", irs, Mrs[i] * (u[2] ** (i + 1)) * e[2]])
return result
"""
Adjoint action of u_r on h_s
--- Carter p.61
"""
def ad_uh(self, u, h):
r = u[1]
s = h[1]
Asr = self.constants.A[s][r]
result = [["h", s, h[2]]]
if Asr != 0:
result += [["e", r, -Asr * u[2] * h[2]]]
return result
"""
Adjoint action u_r on atom
"""
def ad_u_atom(self, u, a):
if a[0] == "e":
return self.ad_ue(u, a)
if a[0] == "h":
return self.ad_uh(u, a)
"""
Adjoint action u_r on vector
"""
def ad_u(self, u, v):
result = []
for a in v:
result += self.ad_u_atom(u, a)
return result
"""
Adjoint action of h_r on e_s
"""
def ad_he(self, t, e):
r = t[1]
s = e[1]
Ars = self.constants.A[r][s]
return [["e", s, (t[2] ** Ars) * e[2]]]
"""
Adjoint action h_r on atom
"""
def ad_h_atom(self, t, a):
if a[0] == "e":
return self.ad_he(t, a)
if a[0] == "h":
return [list(a)]
"""
Adjoint action h_r on vector
"""
def ad_h(self, t, v):
result = []
for a in v:
result += self.ad_h_atom(t, a)
return result
"""
Adjoint action of t_r on e_s
"""
def ad_te(self, t, e):
r = t[1]
s = e[1]
if r == self.roots.minus_r(s):
#
# IS THIS OK FOR NEGATIVE ROOTS?
#
return [["e", s, t[2] * e[2]]]
else:
return [["e", s, e[2]]]
"""
Adjoint action t_r on atom
"""
def ad_t_atom(self, t, a):
if a[0] == "e":
return self.ad_te(t, a)
if a[0] == "h":
return [list(a)]
"""
Adjoint action t_r on vector
"""
# IS THIS OK FOR NEGATIVE ROOTS?
# def ad_t(self,t,v):
# result=[]
# for a in v:
# result+=self.ad_t_atom(t,a)
# return result
"""
Adjoint action of n_r on e_s
"""
def ad_ne(self, n, e):
r = n[1]
s = e[1]
etars = self.constants.eta[r][s]
wr = self.group.weyl.refs[r]
pwr = self.group.weyl.perm[wr]
result = [["e", pwr[s], etars * e[2]]]
if n[2] != 0:
result = self.ad_he(["h", r, n[2]], result[0])
return result
"""
Adjoint action of n_r on h_s
"""
def ad_nh(self, n, h):
r = n[1]
s = h[1]
wr = self.group.weyl.refs[r]
pwr = self.group.weyl.perm[wr]
return [["h", pwr[s], h[2]]]
"""
Adjoint action n_r on atom
"""
def ad_n_atom(self, n, a):
if a[0] == "e":
return self.ad_ne(n, a)
if a[0] == "h":
return self.ad_nh(n, a)
"""
Adjoint action n_r on vector
"""
def ad_n(self, n, v):
result = []
for a in v:
result += self.ad_n_atom(n, a)
return result
"""
Adjoint action of an atoms u,t,n on vector v
"""
def ad_atom(self, a, v):
if a[0] == "u":
return self.ad_u(a, v)
if a[0] == "h":
return self.ad_h(a, v)
# if a[0]=="t":
# return self.ad_t(a,v)
if a[0] == "n":
return self.ad_n(a, v)
print("atom=", a)
print("ad_action.ad_atom: this should not be!")
return False
"""
Adjoint action of the group element g on a vector v
--- we act with the rightmost first so the list needs to be reverted
"""
def ad(self, g, v):
result = list(v)
gg = list(g)
gg.reverse()
for x in gg:
result = self.ad_atom(x, result)
return result
"""
simplify the expressions in a matrix
--- for sympy symbols
"""
@staticmethod
def simplify_mat(mat):
result = []
for i in range(len(mat)):
result.append([])
for ee in mat[i]:
e = sp.simplify(ee)
if type(e) == float or \
type(e) == np.int64 or type(e) == sp.numbers.Float:
if int(e) * 1.0 == e:
# print(i,e)
e = int(e)
result[i].append(e)
return np.array(result)
"""
Adjoint matrix for a group element g
"""
def ad_mat(self, g):
b = self.lie.basis
result = []
for x in b:
tmp = self.ad(g, [x])
# print(g,x,tmp)
tmp = self.lie.canonic_list(tmp)
result.append(tmp)
result = np.array(result)
result = result.transpose()
return result