Przeglądaj źródła

CZ now finds hits for all cases, need to force into {Z}

master
Pete Shadbolt 8 lat temu
rodzic
commit
0ff31c1915
1 zmienionych plików z 19 dodań i 8 usunięć
  1. +19
    -8
      cz_table.py

+ 19
- 8
cz_table.py Wyświetl plik

@@ -6,16 +6,27 @@ import tqdm
# TODO: ensure that Constraint 1 is met. i.e.
# if C1 is in Z, choose C1' such that it is in Z

table1 = []
table2 = []

bond = qi.cz * np.kron(qi.plus, qi.plus)
no_bond = np.kron(qi.plus, qi.plus)

for u in tables.unitaries:
psi = qi.cz*np.kron(u, qi.ha)*bond
print u
def find(thing, table):
for index, trial in enumerate(table):
for qq in range(16):
if np.allclose(thing, np.exp(2j*np.pi*qq/16.) * trial):
yield index

for state in bond, no_bond:
for a in tables.unitaries:
for b in tables.unitaries:
state = np.kron(a, b) * state
table1.append(state)
table2.append(qi.cz*state)

for index, thing in enumerate(table2):
print "{} -> {}".format(index, list(find(thing, table1)))


for bb in bond, no_bond:
for a in tables.unitaries:
for b in tables.unitaries:
if np.allclose(np.kron(a, b)*bb, psi):
print "match"


Ładowanie…
Anuluj
Zapisz