| @@ -6,16 +6,27 @@ import tqdm | |||||
| # TODO: ensure that Constraint 1 is met. i.e. | # TODO: ensure that Constraint 1 is met. i.e. | ||||
| # if C1 is in Z, choose C1' such that it is in Z | # if C1 is in Z, choose C1' such that it is in Z | ||||
| table1 = [] | |||||
| table2 = [] | |||||
| bond = qi.cz * np.kron(qi.plus, qi.plus) | bond = qi.cz * np.kron(qi.plus, qi.plus) | ||||
| no_bond = 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" | |||||