From 0ff31c1915e3a4241f914a405c01e0a2101e0fc0 Mon Sep 17 00:00:00 2001 From: Pete Shadbolt Date: Thu, 5 May 2016 18:49:16 +0100 Subject: [PATCH] CZ now finds hits for all cases, need to force into {Z} --- cz_table.py | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/cz_table.py b/cz_table.py index 19ca112..74a0cc1 100644 --- a/cz_table.py +++ b/cz_table.py @@ -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"