From 200dd9ac4768c258774b0bf8c72e61ac38826f67 Mon Sep 17 00:00:00 2001 From: Pete Shadbolt Date: Thu, 10 Mar 2016 13:22:59 +0000 Subject: [PATCH] Now updates VOPs in local_complementation --- clifford.py | 11 +++++++++-- cz.py | 18 +++++++++++------- viz.py | 2 +- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/clifford.py b/clifford.py index 25a5c93..41032b5 100644 --- a/clifford.py +++ b/clifford.py @@ -7,7 +7,7 @@ unitaries = [p*s for p in permutations for s in signs] import numpy as np from tqdm import tqdm -from qi import * +import qi from functools import reduce from util import cache_to_disk @@ -41,6 +41,13 @@ def construct_tables(): decompositions = ("xxxx", "xx", "zzxx", "zz", "zxx", "z", "zzz", "xxz", "xzx", "xzxxx", "xzzzx", "xxxzx", "xzz", "zzx", "xxx", "x", "zzzx", "xxzx", "zx", "zxxx", "xxxz", "xzzz", "xz", "xzxx") -elements = {"x": sqx, "z": msqz} +elements = {"x": qi.sqx, "z": qi.msqz} unitaries = [compose_u(d) for d in decompositions] conjugation_table, times_table = construct_tables() +sqx = 15 +msqz = 5 + +if __name__ == '__main__': + print find_up_to_phase(qi.sqx) + print find_up_to_phase(qi.msqz) + diff --git a/cz.py b/cz.py index e93bca0..5f607bf 100644 --- a/cz.py +++ b/cz.py @@ -1,14 +1,19 @@ from matplotlib import pyplot as plt from graph import * from viz import draw +import itertools as it +import clifford + def local_complementation(g, vops, v): + """ As defined in LISTING 1 of Anders & Briegel """ + for i, j in it.combinations(g[v], 2): + toggle_edge(g, i, j) + + # Update VOPs + vops[v] = clifford.times_table[vops[v]][clifford.sqx] for i in g[v]: - for j in g[v]: - if i