thesffs/mu.py

36 lines
766 B
Python
Raw Normal View History

2021-12-30 09:23:31 +01:00
import numpy as np
def determu(q,dim,ulayer):
for i in range(dim):
for j in range(i+1,dim):
q=ulayer(dim,i,j)(q)
return q
def determr(q,dim,ulayer):
dex=[]
for i in range(dim):
for j in range(i+1,dim):
dex.append([i,j])
np.random.shuffle(dex)
for i,j in dex:
q=ulayer(dim,i,j)(q)
return q
def partu(q,pdim,dim,ulayer):
for i in range(pdim):
for j in range(i+1,dim):
q=ulayer(dim,i,j)(q)
return q
def partr(q,pdim,dim,ulayer):
dex=[]
for i in range(pdim):
for j in range(i+1,dim):
dex.append([i,j])
np.random.shuffle(dex)
for i,j in dex:
q=ulayer(dim,i,j)(q)
return q
def cutdown(q,pdim):
return q[:,:pdim]