Skip to content

Commit

Permalink
change convention for how we extract the axis-of-rotation angle from …
Browse files Browse the repository at this point in the history
…Euler angles and 2x2 unitaries. Under the new convention, the distribution of axis-of-rotation angles of Haar-distributed SU(2) elements has density 2(sin(t/2))^2/pi for 0 <= t <= pi and zero elsewhere.
  • Loading branch information
rileyjmurray committed Oct 3, 2024
1 parent d8b775b commit 05de6eb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pygsti/tools/su2tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,11 @@ def axis_rotation_angle_from_2x2_unitaries(U):
theta = np.real(2*np.log(eigs[:,0])/1j)
tr = np.trace(U, axis1=1, axis2=2)
check = tr - 2*np.cos(theta/2)
assert abs(check) < 1e-10
assert np.all(abs(check) < 1e-10)
theta[theta < 0] += 2*np.pi
theta[theta > np.pi] = 2*np.pi - theta[theta > np.pi]
return theta

# TODO: interrogate all the places where I'm using np.newaxis and de-vectorize in case I broke things.
@classmethod
def unitaries_from_angles(cls,alpha,beta,gamma):
# Construct an element of SU(2) from Euler angles
Expand Down Expand Up @@ -261,6 +262,9 @@ def angles2irrepchars(cls, angles):
def characters_from_euler_angles(cls,abg):
# Require that a,b,g = abg (so either it's an array of shape (3,) or (3,N) for some N)
theta_by_2 = np.arccos(np.cos(abg[1]/2)*np.cos((abg[0]+abg[2])/2))
theta = 2*theta_by_2
theta[theta > np.pi] = 2*np.pi - theta[theta > np.pi]
theta_by_2 = theta / 2
def char(_k):
return np.sin((2*_k + 1)*theta_by_2)/np.sin(theta_by_2)
out = np.array([ char(_k) for _k in cls.irrep_labels])
Expand Down

0 comments on commit 05de6eb

Please sign in to comment.