forked from spiemonte/TfLeonardYM
-
Notifications
You must be signed in to change notification settings - Fork 1
/
lie_generators.py
37 lines (32 loc) · 1.64 KB
/
lie_generators.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
import numpy as np
_generators = {
(2, "fundamental"): np.array([
[[0, 1], [1, 0]],
[[0, -1j], [1j, 0]],
[[1, 0], [0, -1]]]) / 2.,
(3, "fundamental"): np.array([
[[0, 1, 0], [1, 0, 0], [0, 0, 0]],
[[0, 0, 1], [0, 0, 0], [1, 0, 0]],
[[0, 0, 0], [0, 0, 1], [0, 1, 0]],
[[0, -1j, 0], [1j, 0, 0], [0, 0, 0]],
[[0, 0, -1j], [0, 0, 0], [1j, 0, 0]],
[[0, 0, 0], [0, 0, -1j], [0, 1j, 0]],
[[1, 0, 0], [0, -1, 0], [0, 0, 0]],
[[1. / (np.sqrt(3.)), 0, 0], [0, 1. / (np.sqrt(3.)), 0], [0, 0, -2. / (np.sqrt(3.))]]]) / 2.
}
def generators(nc, representation="fundamental"):
if (nc, representation) in _generators:
return _generators[(nc, representation)]
if representation == "adjoint":
fundamental_lie_generators = generators(nc, representation="fundamental")
adjoint_generators = np.zeros(shape=(nc * nc - 1, nc * nc - 1, nc * nc - 1), dtype=np.complex128)
for i in range(nc * nc - 1):
for j in range(nc * nc - 1):
for k in range(nc * nc - 1):
adjoint_generators[i, j, k] = -2 * np.trace((fundamental_lie_generators[i] @
fundamental_lie_generators[j] -
fundamental_lie_generators[j] @
fundamental_lie_generators[i]) @
fundamental_lie_generators[k])
_generators[(nc, representation)] = adjoint_generators
return adjoint_generators