-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsungen.py
More file actions
57 lines (47 loc) · 1.45 KB
/
sungen.py
File metadata and controls
57 lines (47 loc) · 1.45 KB
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
#!/usr/bin/env python
import numpy as np
from itertools import product
def tgen(N):
"""
Returns the infintesimal generators
for SU(N) in the fundamental representation.
Input: N: the dimension of the group
Output: A numpy array of matricies in the
fundamental representation.
"""
def E(m, i, j):
"""
Returns an m by m matrix with a 1 in
the ith row, jth column.
"""
temp = np.zeros((m, m))
temp[i, j] = 1.0
return temp
def h(x):
"""
Returns a x by x matrix with the x - 1 identity
on the diagonal and minus the trace of that identity
in the last diagonal entry, all normalized.
"""
temp = np.zeros((x, x))
temp[:(x - 1), :(x - 1)] = (np.sqrt(2.0 / (x * (x - 1))) *
np.identity(x - 1))
temp[x - 1, x - 1] = np.sqrt(2.0 / (x * (x - 1))) * (1 - x)
return temp
def hk(x, k):
"""
Returns a x by x matrix with h(k) for the first k
entries, and zeros otherwise.
"""
temp = np.zeros((x, x))
temp[:k, :k] = h(k)
return temp
t = []
for j, k in product(range(N), range(N)):
if (0 <= j < k < N):
t.append(E(N, j, k) + E(N, k, j))
t.append(-1j * E(N, j, k) + 1j * E(N, k, j))
t.append(h(N))
for i in range(2, N):
t.append(hk(N, i))
return np.array(t)