Skip to content

Commit 5a4e664

Browse files
authored
Adds det normalization to SU(N) Haar sampling
1 parent 71721f8 commit 5a4e664

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: suN_haar/suN_haar.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@
22

33
import numpy as np
44

5-
def generate_suN_haar(Nc, *, size):
5+
def generate_uN_haar(Nc, *, size):
66
shape = (size, Nc, Nc)
77
Z = np.random.normal(size=shape) + 1j * np.random.normal(size=shape)
88
Q, R = np.linalg.qr(Z)
99
Lam = np.exp(1j * np.angle(np.einsum('...ii->...i', R)))
1010
U = np.einsum('...ab,...b -> ...ab', Q, Lam)
1111
return U
12+
13+
def generate_suN_haar(Nc, *, size):
14+
U = generate_uN_haar(Nc, size=size)
15+
theta = np.angle(np.linalg.det(U))
16+
z = 2*np.pi*np.random.randint(Nc, size=size)
17+
Up = U * np.exp(1j * (z - theta) / Nc)[...,np.newaxis,np.newaxis]
18+
return Up

0 commit comments

Comments
 (0)