-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathirreps.py
158 lines (124 loc) · 5.06 KB
/
irreps.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
from pathlib import Path
import sys
# Add project directory as root
path = Path(__file__).parent.absolute()
sys.path.insert(0, str(path.parent))
from angular_momentum import J_x as SU2_Jx, J_y as SU2_Jy, J_z as SU2_Jz
import numpy as np
def J_x(m: float, n: float) -> np.ndarray:
"""Rotation operator for the Lorentz group around the x-axis
for the :math:`(m, n) `representation.
Reference: https://en.wikipedia.org/wiki/Representation_theory_of_the_Lorentz_group
:param m: Weight :math:`m` of the representation (Half-integer).
:type m: float
:param n: Weight :math:`n` of the representation (Half-integer).
:type n: int
:return: Rotation operator for the Lorentz group around the x-axis.
:rtype: np.ndarray
:raises ValueError: If m or n are not half-integers
"""
__check_half_ints(m, n)
return __Ji(m, n, 0)
def J_y(m: float, n: float) -> np.ndarray:
"""Rotation operator for the Lorentz group around the y-axis
for the :math:`(m, n) `representation.
Reference: https://en.wikipedia.org/wiki/Representation_theory_of_the_Lorentz_group
:param m: Weight :math:`m` of the representation (Half-integer).
:type m: float
:param n: Weight :math:`n` of the representation (Half-integer).
:type n: int
:return: Rotation operator for the Lorentz group around the y-axis.
:rtype: np.ndarray
:raises ValueError: If m or n are not half-integers
"""
__check_half_ints(m, n)
return __Ji(m, n, 1)
def J_z(m: float, n: float) -> np.ndarray:
"""Rotation operator for the Lorentz group around the z-axis
for the :math:`(m, n) `representation.
Reference: https://en.wikipedia.org/wiki/Representation_theory_of_the_Lorentz_group
:param m: Weight :math:`m` of the representation (Half-integer).
:type m: float
:param n: Weight :math:`n` of the representation (Half-integer).
:type n: int
:return: Rotation operator for the Lorentz group around the z-axis.
:rtype: np.ndarray
:raises ValueError: If m or n are not half-integers
"""
__check_half_ints(m, n)
return __Ji(m, n, 2)
def K_x(m: float, n: float) -> np.ndarray:
"""Boost operator for the Lorentz group along the x-axis
for the :math:`(m, n) `representation.
Reference: https://en.wikipedia.org/wiki/Representation_theory_of_the_Lorentz_group
:param m: Weight :math:`m` of the representation (Half-integer).
:type m: float
:param n: Weight :math:`n` of the representation (Half-integer).
:type n: int
:return: Boost operator for the Lorentz group around the x-axis.
:rtype: np.ndarray
:raises ValueError: If m or n are not half-integers
"""
__check_half_ints(m, n)
return __Ki(m, n, 0)
def K_y(m: float, n: float) -> np.ndarray:
"""Boost operator for the Lorentz group along the y-axis
for the :math:`(m, n) `representation.
Reference: https://en.wikipedia.org/wiki/Representation_theory_of_the_Lorentz_group
:param m: Weight :math:`m` of the representation (Half-integer).
:type m: float
:param n: Weight :math:`n` of the representation (Half-integer).
:type n: int
:return: Boost operator for the Lorentz group around the y-axis.
:rtype: np.ndarray
:raises ValueError: If m or n are not half-integers
"""
__check_half_ints(m, n)
return __Ki(m, n, 1)
def K_z(m: float, n: float) -> np.ndarray:
"""Boost operator for the Lorentz group along the z-axis
for the :math:`(m, n) `representation.
Reference: https://en.wikipedia.org/wiki/Representation_theory_of_the_Lorentz_group
:param m: Weight :math:`m` of the representation (Half-integer).
:type m: float
:param n: Weight :math:`n` of the representation (Half-integer).
:type n: int
:return: Boost operator for the Lorentz group around the z-axis.
:rtype: np.ndarray
:raises ValueError: If m or n are not half-integers
"""
__check_half_ints(m, n)
return __Ki(m, n, 2)
def __Ji(m: float, n: float, i: int) -> np.ndarray:
"""Generates the rotation operator for the Lorentz group around the i-th axis."""
Js = (SU2_Jx, SU2_Jy, SU2_Jz)
return np.tensordot(a=Js[i](m), b=np.eye(int(2 * n + 1)), axes=0) + np.tensordot(
a=np.eye(int(2 * m + 1)), b=Js[i](n), axes=0
)
def __Ki(m: float, n: float, i: int) -> np.ndarray:
"""Generates the boost operator for the Lorentz group along the i-th axis."""
Js = (SU2_Jx, SU2_Jy, SU2_Jz)
return 1.0j * np.tensordot(
a=Js[i](m), b=np.eye(int(2 * n + 1)), axes=0
) - np.tensordot(a=np.eye(int(2 * m + 1)), b=Js[i](n), axes=0)
def __check_half_ints(m: float, n: float) -> None:
"""Check if m and n are half-integers.
:raises ValueError: If m is not a half-integer.
:raises ValueError: If n is not a half-integer.
"""
if (2 * m) % 2 != 0:
raise ValueError(f"m must be a half-integer, but m={m} is not.")
elif (2 * n) % 2 != 0:
raise ValueError(f"n must be a half-integer, but n={n} is not.")
else:
pass
__ALL__ = [
# rotation operators
J_x,
J_y,
J_z,
# boost operators
K_x,
K_y,
K_z,
]