Przeglądaj źródła

Think I found it

master
Pete Shadbolt 8 lat temu
rodzic
commit
b06c1c38d8
5 zmienionych plików z 797 dodań i 13 usunięć
  1. +19
    -13
      abp/graphstate.py
  2. +381
    -0
      debug_anders.txt
  3. +364
    -0
      debug_pete.txt
  4. +1
    -0
      scripts/wtf.py
  5. +32
    -0
      scripts/wtf2.py

+ 19
- 13
abp/graphstate.py Wyświetl plik

@@ -7,8 +7,9 @@ import json
import qi, clifford, util
import random

output = open("debug_pete.txt", "w")
def debug(x):
pass
output.write(str(x)+"\n")

class GraphState(object):

@@ -41,6 +42,7 @@ class GraphState(object):

def del_edge(self, v1, v2):
""" Delete an edge between two vertices in the self """
debug("deling edge")
del self.adj[v1][v2]
del self.adj[v2][v1]

@@ -65,7 +67,7 @@ class GraphState(object):

def remove_vop(self, a, avoid):
""" Reduces VOP[a] to the identity """
# TODO: sucks!
others = set(self.adj[a]) - {avoid}
swap_qubit = others.pop() if others else avoid

@@ -73,10 +75,16 @@ class GraphState(object):
self.print_adj_list_line(a)
self.print_adj_list_line(avoid)
self.print_adj_list_line(swap_qubit)
debug("using {}".format(clifford.decompositions[self.node[a]["vop"]]))
converted = clifford.decompositions[self.node[a]["vop"]]
converted = "".join("U" if x == "x" else "V" for x in converted)
debug("using {}".format(converted))

for v in reversed(clifford.decompositions[self.node[a]["vop"]]):
self.local_complementation(a if v == "x" else swap_qubit)
if v == "x":
self.local_complementation(a, "U ->")
else:
self.local_complementation(swap_qubit, "V ->")

assert self.node[a]["vop"]==0

debug("remove_byprod_op: after (v, avoid, vb):")
@@ -84,9 +92,11 @@ class GraphState(object):
self.print_adj_list_line(avoid)
self.print_adj_list_line(swap_qubit)

def local_complementation(self, v):
assert self.node[a]["vop"] == 0

def local_complementation(self, v, prefix = ""):
""" As defined in LISTING 1 of Anders & Briegel """
debug("V ->Inverting about {}".format(self.get_adj_list_line(v)))
debug("{}Inverting about {}".format(prefix, self.get_adj_list_line(v)))
for i, j in it.combinations(self.adj[v], 2):
self.toggle_edge(i, j)

@@ -149,19 +159,15 @@ class GraphState(object):
assert ci["non1"]==False or clifford.is_diagonal(self.node[a]["vop"])
assert ci["non2"]==False or clifford.is_diagonal(self.node[b]["vop"])
except AssertionError:
print ci
print self.node[a]["vop"]
print self.node[b]["vop"]
debug(ci)
debug(self.node[a]["vop"])
debug(self.node[b]["vop"])
edge = self.has_edge(a, b)
new_edge, self.node[a]["vop"], self.node[
b]["vop"] = clifford.cz_table[edge, self.node[a]["vop"], self.node[b]["vop"]]
if new_edge != edge:
self.toggle_edge(a, b)
if new_edge:
debug("adding edge")
else:
debug("deling edge")

debug("cphase_with_table: after")
self.print_adj_list_line(a)


+ 381
- 0
debug_anders.txt Wyświetl plik

@@ -0,0 +1,381 @@
before cphase between 0 and 1
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
cphase_with_table called on:
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
deling edge 0 - 1
deling edge
cphase_with_table: after:
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
before cphase between 0 and 1
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
cphase_with_table called on:
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
deling edge 0 - 1
deling edge
cphase_with_table: after:
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
before cphase between 0 and 1
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
cphase_with_table called on:
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
deling edge 0 - 1
deling edge
cphase_with_table: after:
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
before cphase between 0 and 1
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
cphase_with_table called on:
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
deling edge 0 - 1
deling edge
cphase_with_table: after:
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
before cphase between 1 and 2
Vertex 1: VOp YC, neighbors
Vertex 2: VOp YC, neighbors
cphase_with_table called on:
Vertex 1: VOp YC, neighbors
Vertex 2: VOp YC, neighbors
deling edge 1 - 2
deling edge
cphase_with_table: after:
Vertex 1: VOp YC, neighbors
Vertex 2: VOp YC, neighbors
before cphase between 0 and 1
Vertex 0: VOp IA, neighbors
Vertex 1: VOp YC, neighbors
cphase_with_table called on:
Vertex 0: VOp IA, neighbors
Vertex 1: VOp YC, neighbors
deling edge 0 - 1
deling edge
cphase_with_table: after:
Vertex 0: VOp IA, neighbors
Vertex 1: VOp YC, neighbors
before cphase between 0 and 1
Vertex 0: VOp IA, neighbors
Vertex 1: VOp IA, neighbors
cphase_with_table called on:
Vertex 0: VOp IA, neighbors
Vertex 1: VOp IA, neighbors
adding edge
cphase_with_table: after:
Vertex 0: VOp IA, neighbors 1
Vertex 1: VOp IA, neighbors 0
before cphase between 1 and 2
Vertex 1: VOp IA, neighbors 0
Vertex 2: VOp IA, neighbors
cphase: left vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0
Vertex 2: VOp IA, neighbors
Vertex 0: VOp IA, neighbors 1
using UUUU
U ->Inverting about Vertex 1: VOp IA, neighbors 0
U ->Inverting about Vertex 1: VOp YD, neighbors 0
U ->Inverting about Vertex 1: VOp XA, neighbors 0
U ->Inverting about Vertex 1: VOp ZD, neighbors 0
remove_byprod_op, after: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0
Vertex 2: VOp IA, neighbors
Vertex 0: VOp IA, neighbors 1
cphase_with_table called on:
Vertex 1: VOp IA, neighbors 0
Vertex 2: VOp IA, neighbors
adding edge
cphase_with_table: after:
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp IA, neighbors 1
before cphase between 1 and 2
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp YC, neighbors 1
cphase: left vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp YC, neighbors 1
Vertex 0: VOp IA, neighbors 1
using UUUU
U ->Inverting about Vertex 1: VOp IA, neighbors 0 2
U ->Inverting about Vertex 1: VOp YD, neighbors 0 2
U ->Inverting about Vertex 1: VOp XA, neighbors 0 2
U ->Inverting about Vertex 1: VOp ZD, neighbors 0 2
remove_byprod_op, after: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp YC, neighbors 1
Vertex 0: VOp IA, neighbors 1
cphase_with_table called on:
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp YC, neighbors 1
adding edge
cphase_with_table: after:
Vertex 1: VOp XB, neighbors 0 2
Vertex 2: VOp XF, neighbors 1
before cphase between 1 and 2
Vertex 1: VOp XB, neighbors 0 2
Vertex 2: VOp XF, neighbors 1
cphase: left vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp XB, neighbors 0 2
Vertex 2: VOp XF, neighbors 1
Vertex 0: VOp IA, neighbors 1
using V
V ->Inverting about Vertex 0: VOp IA, neighbors 1
remove_byprod_op, after: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp XF, neighbors 1
Vertex 0: VOp YD, neighbors 1
cphase_with_table called on:
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp XF, neighbors 1
adding edge
cphase_with_table: after:
Vertex 1: VOp XB, neighbors 0 2
Vertex 2: VOp ZC, neighbors 1
before cphase between 1 and 2
Vertex 1: VOp XB, neighbors 0 2
Vertex 2: VOp ZC, neighbors 1
cphase: left vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp XB, neighbors 0 2
Vertex 2: VOp ZC, neighbors 1
Vertex 0: VOp YD, neighbors 1
using V
V ->Inverting about Vertex 0: VOp YD, neighbors 1
remove_byprod_op, after: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp ZC, neighbors 1
Vertex 0: VOp XA, neighbors 1
cphase_with_table called on:
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp ZC, neighbors 1
adding edge
cphase_with_table: after:
Vertex 1: VOp XB, neighbors 0 2
Vertex 2: VOp IF, neighbors 1
before cphase between 0 and 1
Vertex 0: VOp XA, neighbors 1
Vertex 1: VOp XB, neighbors 0 2
cphase: right vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp XB, neighbors 0 2
Vertex 0: VOp XA, neighbors 1
Vertex 2: VOp IF, neighbors 1
using V
V ->Inverting about Vertex 2: VOp IF, neighbors 1
remove_byprod_op, after: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 0: VOp XA, neighbors 1
Vertex 2: VOp YC, neighbors 1
cphase_with_table called on:
Vertex 0: VOp XA, neighbors 1
Vertex 1: VOp IA, neighbors 0 2
deling edge 0 - 1
deling edge
cphase_with_table: after:
Vertex 0: VOp IA, neighbors
Vertex 1: VOp ZA, neighbors 2
before cphase between 0 and 1
Vertex 0: VOp IA, neighbors
Vertex 1: VOp ZA, neighbors 2
cphase: right vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp ZA, neighbors 2
Vertex 0: VOp IA, neighbors
Vertex 2: VOp IA, neighbors 1
using VV
V ->Inverting about Vertex 2: VOp IA, neighbors 1
V ->Inverting about Vertex 2: VOp YD, neighbors 1
remove_byprod_op, after: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 2
Vertex 0: VOp IA, neighbors
Vertex 2: VOp XA, neighbors 1
cphase_with_table called on:
Vertex 0: VOp IA, neighbors
Vertex 1: VOp IA, neighbors 2
adding edge
cphase_with_table: after:
Vertex 0: VOp IA, neighbors 1
Vertex 1: VOp IA, neighbors 0 2
before cphase between 0 and 1
Vertex 0: VOp IA, neighbors 1
Vertex 1: VOp IA, neighbors 0 2
cphase: right vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 0: VOp IA, neighbors 1
Vertex 2: VOp ZC, neighbors 1
using UUUU
U ->Inverting about Vertex 1: VOp IA, neighbors 0 2
U ->Inverting about Vertex 1: VOp YD, neighbors 0 2
U ->Inverting about Vertex 1: VOp XA, neighbors 0 2
U ->Inverting about Vertex 1: VOp ZD, neighbors 0 2
remove_byprod_op, after: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 0: VOp IA, neighbors 1
Vertex 2: VOp ZC, neighbors 1
cphase_with_table called on:
Vertex 0: VOp IA, neighbors 1
Vertex 1: VOp IA, neighbors 0 2
deling edge 0 - 1
deling edge
cphase_with_table: after:
Vertex 0: VOp IA, neighbors
Vertex 1: VOp IA, neighbors 2
before cphase between 0 and 1
Vertex 0: VOp IA, neighbors
Vertex 1: VOp IA, neighbors 2
cphase: right vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 2
Vertex 0: VOp IA, neighbors
Vertex 2: VOp ZC, neighbors 1
using UUUU
U ->Inverting about Vertex 1: VOp IA, neighbors 2
U ->Inverting about Vertex 1: VOp YD, neighbors 2
U ->Inverting about Vertex 1: VOp XA, neighbors 2
U ->Inverting about Vertex 1: VOp ZD, neighbors 2
remove_byprod_op, after: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 2
Vertex 0: VOp IA, neighbors
Vertex 2: VOp ZC, neighbors 1
cphase_with_table called on:
Vertex 0: VOp IA, neighbors
Vertex 1: VOp IA, neighbors 2
adding edge
cphase_with_table: after:
Vertex 0: VOp IA, neighbors 1
Vertex 1: VOp IA, neighbors 0 2
before cphase between 0 and 1
Vertex 0: VOp YC, neighbors 1
Vertex 1: VOp IA, neighbors 0 2
cphase: right vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 0: VOp YC, neighbors 1
Vertex 2: VOp XA, neighbors 1
using UUUU
U ->Inverting about Vertex 1: VOp IA, neighbors 0 2
U ->Inverting about Vertex 1: VOp YD, neighbors 0 2
U ->Inverting about Vertex 1: VOp XA, neighbors 0 2
U ->Inverting about Vertex 1: VOp ZD, neighbors 0 2
remove_byprod_op, after: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 0: VOp YC, neighbors 1
Vertex 2: VOp XA, neighbors 1
cphase_with_table called on:
Vertex 0: VOp YC, neighbors 1
Vertex 1: VOp IA, neighbors 0 2
adding edge
cphase_with_table: after:
Vertex 0: VOp IF, neighbors 1
Vertex 1: VOp YB, neighbors 0 2
before cphase between 1 and 2
Vertex 1: VOp YB, neighbors 0 2
Vertex 2: VOp XA, neighbors 1
cphase: left vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp YB, neighbors 0 2
Vertex 2: VOp XA, neighbors 1
Vertex 0: VOp IF, neighbors 1
using VVV
V ->Inverting about Vertex 0: VOp IF, neighbors 1
V ->Inverting about Vertex 0: VOp YC, neighbors 1
V ->Inverting about Vertex 0: VOp XF, neighbors 1
remove_byprod_op, after: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp XA, neighbors 1
Vertex 0: VOp ZC, neighbors 1
cphase_with_table called on:
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp XA, neighbors 1
deling edge 1 - 2
deling edge
cphase_with_table: after:
Vertex 1: VOp ZA, neighbors 0
Vertex 2: VOp IA, neighbors
before cphase between 0 and 1
Vertex 0: VOp ZC, neighbors 1
Vertex 1: VOp ZA, neighbors 0
cphase_with_table called on:
Vertex 0: VOp ZC, neighbors 1
Vertex 1: VOp ZA, neighbors 0
adding edge
cphase_with_table: after:
Vertex 0: VOp IF, neighbors 1
Vertex 1: VOp YB, neighbors 0
before cphase between 1 and 2
Vertex 1: VOp YB, neighbors 0
Vertex 2: VOp IA, neighbors
cphase: left vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp YB, neighbors 0
Vertex 2: VOp IA, neighbors
Vertex 0: VOp IF, neighbors 1
using VVV
V ->Inverting about Vertex 0: VOp IF, neighbors 1
V ->Inverting about Vertex 0: VOp YC, neighbors 1
V ->Inverting about Vertex 0: VOp XF, neighbors 1
remove_byprod_op, after: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0
Vertex 2: VOp IA, neighbors
Vertex 0: VOp ZC, neighbors 1
cphase_with_table called on:
Vertex 1: VOp IA, neighbors 0
Vertex 2: VOp IA, neighbors
adding edge
cphase_with_table: after:
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp IA, neighbors 1
before cphase between 0 and 1
Vertex 0: VOp ZC, neighbors 1
Vertex 1: VOp YC, neighbors 0 2
cphase: right vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp YC, neighbors 0 2
Vertex 0: VOp ZC, neighbors 1
Vertex 2: VOp IA, neighbors 1
using UVVVU
U ->Inverting about Vertex 1: VOp YC, neighbors 0 2
V ->Inverting about Vertex 2: VOp YB, neighbors 0 1
V ->Inverting about Vertex 2: VOp XE, neighbors 0 1
V ->Inverting about Vertex 2: VOp ZB, neighbors 0 1
U ->Inverting about Vertex 1: VOp ZD, neighbors 2
remove_byprod_op, after: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 2
Vertex 0: VOp ZC, neighbors 2
Vertex 2: VOp YC, neighbors 0 1
cphase: left one needs treatment again -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 0: VOp ZC, neighbors 2
Vertex 1: VOp IA, neighbors 2
Vertex 2: VOp YC, neighbors 0 1
using UUUVU
U ->Inverting about Vertex 0: VOp ZC, neighbors 2
V ->Inverting about Vertex 2: VOp ZE, neighbors 0 1
U ->Inverting about Vertex 0: VOp YD, neighbors 1 2
U ->Inverting about Vertex 0: VOp XA, neighbors 1 2
U ->Inverting about Vertex 0: VOp ZD, neighbors 1 2
remove_byprod_op, after: (v, avoid, vb):
Vertex 0: VOp IA, neighbors 1 2
Vertex 1: VOp IA, neighbors 0
Vertex 2: VOp XA, neighbors 0
cphase_with_table called on:
Vertex 0: VOp IA, neighbors 1 2
Vertex 1: VOp IA, neighbors 0
deling edge 0 - 1
deling edge
cphase_with_table: after:
Vertex 0: VOp IA, neighbors 2
Vertex 1: VOp IA, neighbors

+ 364
- 0
debug_pete.txt Wyświetl plik

@@ -0,0 +1,364 @@
before cphase between 0 and 1
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
cphase_with_table called on:
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
cphase_with_table: after
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
before cphase between 0 and 1
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
cphase_with_table called on:
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
cphase_with_table: after
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
before cphase between 0 and 1
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
cphase_with_table called on:
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
cphase_with_table: after
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
before cphase between 0 and 1
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
cphase_with_table called on:
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
cphase_with_table: after
Vertex 0: VOp YC, neighbors
Vertex 1: VOp YC, neighbors
before cphase between 1 and 2
Vertex 1: VOp YC, neighbors
Vertex 2: VOp YC, neighbors
cphase_with_table called on:
Vertex 1: VOp YC, neighbors
Vertex 2: VOp YC, neighbors
cphase_with_table: after
Vertex 1: VOp YC, neighbors
Vertex 2: VOp YC, neighbors
before cphase between 0 and 1
Vertex 0: VOp IA, neighbors
Vertex 1: VOp YC, neighbors
cphase_with_table called on:
Vertex 0: VOp IA, neighbors
Vertex 1: VOp YC, neighbors
cphase_with_table: after
Vertex 0: VOp IA, neighbors
Vertex 1: VOp YC, neighbors
before cphase between 0 and 1
Vertex 0: VOp IA, neighbors
Vertex 1: VOp IA, neighbors
cphase_with_table called on:
Vertex 0: VOp IA, neighbors
Vertex 1: VOp IA, neighbors
cphase_with_table: after
Vertex 0: VOp IA, neighbors 1
Vertex 1: VOp IA, neighbors 0
before cphase between 1 and 2
Vertex 1: VOp IA, neighbors 0
Vertex 2: VOp IA, neighbors
cphase: left vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0
Vertex 2: VOp IA, neighbors
Vertex 0: VOp IA, neighbors 1
using UUUU
U ->Inverting about Vertex 1: VOp IA, neighbors 0
U ->Inverting about Vertex 1: VOp YD, neighbors 0
U ->Inverting about Vertex 1: VOp XA, neighbors 0
U ->Inverting about Vertex 1: VOp ZD, neighbors 0
remove_byprod_op: after (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0
Vertex 2: VOp IA, neighbors
Vertex 0: VOp IA, neighbors 1
cphase_with_table called on:
Vertex 1: VOp IA, neighbors 0
Vertex 2: VOp IA, neighbors
cphase_with_table: after
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp IA, neighbors 1
before cphase between 1 and 2
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp YC, neighbors 1
cphase: left vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp YC, neighbors 1
Vertex 0: VOp IA, neighbors 1
using UUUU
U ->Inverting about Vertex 1: VOp IA, neighbors 0 2
U ->Inverting about Vertex 1: VOp YD, neighbors 0 2
deling edge
U ->Inverting about Vertex 1: VOp XA, neighbors 0 2
U ->Inverting about Vertex 1: VOp ZD, neighbors 0 2
deling edge
remove_byprod_op: after (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp YC, neighbors 1
Vertex 0: VOp IA, neighbors 1
cphase_with_table called on:
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp YC, neighbors 1
cphase_with_table: after
Vertex 1: VOp XB, neighbors 0 2
Vertex 2: VOp XF, neighbors 1
before cphase between 1 and 2
Vertex 1: VOp XB, neighbors 0 2
Vertex 2: VOp XF, neighbors 1
cphase: left vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp XB, neighbors 0 2
Vertex 2: VOp XF, neighbors 1
Vertex 0: VOp IA, neighbors 1
using V
V ->Inverting about Vertex 0: VOp IA, neighbors 1
remove_byprod_op: after (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp XF, neighbors 1
Vertex 0: VOp YD, neighbors 1
cphase_with_table called on:
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp XF, neighbors 1
cphase_with_table: after
Vertex 1: VOp XB, neighbors 0 2
Vertex 2: VOp ZC, neighbors 1
before cphase between 1 and 2
Vertex 1: VOp XB, neighbors 0 2
Vertex 2: VOp ZC, neighbors 1
cphase: left vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp XB, neighbors 0 2
Vertex 2: VOp ZC, neighbors 1
Vertex 0: VOp YD, neighbors 1
using V
V ->Inverting about Vertex 0: VOp YD, neighbors 1
remove_byprod_op: after (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp ZC, neighbors 1
Vertex 0: VOp XA, neighbors 1
cphase_with_table called on:
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp ZC, neighbors 1
cphase_with_table: after
Vertex 1: VOp XB, neighbors 0 2
Vertex 2: VOp IF, neighbors 1
before cphase between 0 and 1
Vertex 0: VOp XA, neighbors 1
Vertex 1: VOp XB, neighbors 0 2
cphase: right vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp XB, neighbors 0 2
Vertex 0: VOp XA, neighbors 1
Vertex 2: VOp IF, neighbors 1
using V
V ->Inverting about Vertex 2: VOp IF, neighbors 1
remove_byprod_op: after (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 0: VOp XA, neighbors 1
Vertex 2: VOp YC, neighbors 1
cphase_with_table called on:
Vertex 0: VOp XA, neighbors 1
Vertex 1: VOp IA, neighbors 0 2
deling edge
cphase_with_table: after
Vertex 0: VOp IA, neighbors
Vertex 1: VOp ZA, neighbors 2
before cphase between 0 and 1
Vertex 0: VOp IA, neighbors
Vertex 1: VOp ZA, neighbors 2
cphase: right vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp ZA, neighbors 2
Vertex 0: VOp IA, neighbors
Vertex 2: VOp IA, neighbors 1
using VV
V ->Inverting about Vertex 2: VOp IA, neighbors 1
V ->Inverting about Vertex 2: VOp YD, neighbors 1
remove_byprod_op: after (v, avoid, vb):
Vertex 1: VOp IA, neighbors 2
Vertex 0: VOp IA, neighbors
Vertex 2: VOp XA, neighbors 1
cphase_with_table called on:
Vertex 0: VOp IA, neighbors
Vertex 1: VOp IA, neighbors 2
cphase_with_table: after
Vertex 0: VOp IA, neighbors 1
Vertex 1: VOp IA, neighbors 0 2
before cphase between 0 and 1
Vertex 0: VOp IA, neighbors 1
Vertex 1: VOp IA, neighbors 0 2
cphase: right vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 0: VOp IA, neighbors 1
Vertex 2: VOp ZC, neighbors 1
using UUUU
U ->Inverting about Vertex 1: VOp IA, neighbors 0 2
U ->Inverting about Vertex 1: VOp YD, neighbors 0 2
deling edge
U ->Inverting about Vertex 1: VOp XA, neighbors 0 2
U ->Inverting about Vertex 1: VOp ZD, neighbors 0 2
deling edge
remove_byprod_op: after (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 0: VOp IA, neighbors 1
Vertex 2: VOp ZC, neighbors 1
cphase_with_table called on:
Vertex 0: VOp IA, neighbors 1
Vertex 1: VOp IA, neighbors 0 2
deling edge
cphase_with_table: after
Vertex 0: VOp IA, neighbors
Vertex 1: VOp IA, neighbors 2
before cphase between 0 and 1
Vertex 0: VOp IA, neighbors
Vertex 1: VOp IA, neighbors 2
cphase: right vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 2
Vertex 0: VOp IA, neighbors
Vertex 2: VOp ZC, neighbors 1
using UUUU
U ->Inverting about Vertex 1: VOp IA, neighbors 2
U ->Inverting about Vertex 1: VOp YD, neighbors 2
U ->Inverting about Vertex 1: VOp XA, neighbors 2
U ->Inverting about Vertex 1: VOp ZD, neighbors 2
remove_byprod_op: after (v, avoid, vb):
Vertex 1: VOp IA, neighbors 2
Vertex 0: VOp IA, neighbors
Vertex 2: VOp ZC, neighbors 1
cphase_with_table called on:
Vertex 0: VOp IA, neighbors
Vertex 1: VOp IA, neighbors 2
cphase_with_table: after
Vertex 0: VOp IA, neighbors 1
Vertex 1: VOp IA, neighbors 0 2
before cphase between 0 and 1
Vertex 0: VOp YC, neighbors 1
Vertex 1: VOp IA, neighbors 0 2
cphase: right vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 0: VOp YC, neighbors 1
Vertex 2: VOp XA, neighbors 1
using UUUU
U ->Inverting about Vertex 1: VOp IA, neighbors 0 2
U ->Inverting about Vertex 1: VOp YD, neighbors 0 2
deling edge
U ->Inverting about Vertex 1: VOp XA, neighbors 0 2
U ->Inverting about Vertex 1: VOp ZD, neighbors 0 2
deling edge
remove_byprod_op: after (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 0: VOp YC, neighbors 1
Vertex 2: VOp XA, neighbors 1
cphase_with_table called on:
Vertex 0: VOp YC, neighbors 1
Vertex 1: VOp IA, neighbors 0 2
cphase_with_table: after
Vertex 0: VOp IF, neighbors 1
Vertex 1: VOp YB, neighbors 0 2
before cphase between 1 and 2
Vertex 1: VOp YB, neighbors 0 2
Vertex 2: VOp XA, neighbors 1
cphase: left vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp YB, neighbors 0 2
Vertex 2: VOp XA, neighbors 1
Vertex 0: VOp IF, neighbors 1
using VVV
V ->Inverting about Vertex 0: VOp IF, neighbors 1
V ->Inverting about Vertex 0: VOp YC, neighbors 1
V ->Inverting about Vertex 0: VOp XF, neighbors 1
remove_byprod_op: after (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp XA, neighbors 1
Vertex 0: VOp ZC, neighbors 1
cphase_with_table called on:
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp XA, neighbors 1
deling edge
cphase_with_table: after
Vertex 1: VOp ZA, neighbors 0
Vertex 2: VOp IA, neighbors
before cphase between 0 and 1
Vertex 0: VOp ZC, neighbors 1
Vertex 1: VOp ZA, neighbors 0
cphase_with_table called on:
Vertex 0: VOp ZC, neighbors 1
Vertex 1: VOp ZA, neighbors 0
cphase_with_table: after
Vertex 0: VOp IF, neighbors 1
Vertex 1: VOp YB, neighbors 0
before cphase between 1 and 2
Vertex 1: VOp YB, neighbors 0
Vertex 2: VOp IA, neighbors
cphase: left vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp YB, neighbors 0
Vertex 2: VOp IA, neighbors
Vertex 0: VOp IF, neighbors 1
using VVV
V ->Inverting about Vertex 0: VOp IF, neighbors 1
V ->Inverting about Vertex 0: VOp YC, neighbors 1
V ->Inverting about Vertex 0: VOp XF, neighbors 1
remove_byprod_op: after (v, avoid, vb):
Vertex 1: VOp IA, neighbors 0
Vertex 2: VOp IA, neighbors
Vertex 0: VOp ZC, neighbors 1
cphase_with_table called on:
Vertex 1: VOp IA, neighbors 0
Vertex 2: VOp IA, neighbors
cphase_with_table: after
Vertex 1: VOp IA, neighbors 0 2
Vertex 2: VOp IA, neighbors 1
before cphase between 0 and 1
Vertex 0: VOp ZC, neighbors 1
Vertex 1: VOp YC, neighbors 0 2
cphase: right vertex has NONs -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp YC, neighbors 0 2
Vertex 0: VOp ZC, neighbors 1
Vertex 2: VOp IA, neighbors 1
using UVVVU
U ->Inverting about Vertex 1: VOp YC, neighbors 0 2
V ->Inverting about Vertex 2: VOp YB, neighbors 0 1
deling edge
V ->Inverting about Vertex 2: VOp XE, neighbors 0 1
V ->Inverting about Vertex 2: VOp ZB, neighbors 0 1
deling edge
U ->Inverting about Vertex 1: VOp ZD, neighbors 2
remove_byprod_op: after (v, avoid, vb):
Vertex 1: VOp IA, neighbors 2
Vertex 0: VOp ZC, neighbors 2
Vertex 2: VOp YC, neighbors 0 1
cphase: left one needs treatment again -> putting it to Id
remove_byprod_op called: (v, avoid, vb):
Vertex 1: VOp IA, neighbors 2
Vertex 0: VOp ZC, neighbors 2
Vertex 2: VOp YC, neighbors 0 1
using UUUU
U ->Inverting about Vertex 1: VOp IA, neighbors 2
U ->Inverting about Vertex 1: VOp YD, neighbors 2
U ->Inverting about Vertex 1: VOp XA, neighbors 2
U ->Inverting about Vertex 1: VOp ZD, neighbors 2
remove_byprod_op: after (v, avoid, vb):
Vertex 1: VOp IA, neighbors 2
Vertex 0: VOp ZC, neighbors 2
Vertex 2: VOp YC, neighbors 0 1
cphase_with_table called on:
Vertex 0: VOp ZC, neighbors 2
Vertex 1: VOp IA, neighbors 2
{'was_edge': False, 'non1': True, 'non2': True}
11
0
cphase_with_table: after
Vertex 0: VOp YC, neighbors 2
Vertex 1: VOp IA, neighbors 2

+ 1
- 0
scripts/wtf.py Wyświetl plik

@@ -31,4 +31,5 @@ def anders():
b.print_adj_list()

pete()
anders()


+ 32
- 0
scripts/wtf2.py Wyświetl plik

@@ -0,0 +1,32 @@
from abp import GraphState
from anders_briegel import graphsim
from abp import clifford
import random, difflib, re
from copy import deepcopy


def isequal(a, b):
""" TODO: Sketchy as you like. Remove this abomination """
aa = a.get_adj_list()
bb = b.adj_list()
return re.sub("\\s", "", aa) == re.sub("\\s", "", bb)

clifford.use_old_cz()

N = 3

a = graphsim.GraphRegister(N)
b = GraphState(range(N))
previous_state, previous_cz = None, None
while isequal(a, b):
if random.random()>0.5:
j = random.randint(0, N-1)
a.hadamard(j)
b.act_hadamard(j)
else:
q = random.randint(0, N-2)
if a!=b:
a.cphase(q, q+1)
b.act_cz(q, q+1)



Ładowanie…
Anuluj
Zapisz