From 75e4836fdef2be3b7b87562244ee5543b17253e4 Mon Sep 17 00:00:00 2001 From: Pete Shadbolt Date: Wed, 24 Feb 2016 13:38:44 +0000 Subject: [PATCH] Gonna go from scratch --- abp.py | 9 ++++----- clifford.py | 1 - rightphase.py | 8 ++++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/abp.py b/abp.py index 4ef7ede..a1ab2fd 100644 --- a/abp.py +++ b/abp.py @@ -1,5 +1,4 @@ from clifford import * -from rightphase import RightPhase """ Porting Anders and Briegel to Python @@ -15,7 +14,7 @@ class Stabilizer(object): self.rowsigns = [None for i in range(n)] for i in range(n): - self.rowsigns[i] = RightPhase(0) + self.rowsigns[i] = 0 % 4 for j in range(n): if i == j: self.paulis[i][j] = lco_x @@ -24,7 +23,7 @@ class Stabilizer(object): else: self.paulis[i][j] = lco_id - #self.conjugate(i, j, graph.vertices[j].vertex_operator) + self.conjugate(i, j, graph.vertices[j].vertex_operator) def conjugate(self, i, j, vertex_operator): self.rowsigns[j] = self.rowsigns[j] + \ @@ -74,8 +73,8 @@ class GraphRegister(object): for n in v.neighbors)) def __str__(self, ): - return "\n".join(str(v) for v in self.vertices - if len(v.neighbors) > 0) + return "graph:\n"+"\n".join(str(v) for v in self.vertices if len(v.neighbors) > 0) + if __name__ == '__main__': g = GraphRegister(10) diff --git a/clifford.py b/clifford.py index d06770c..56ea556 100644 --- a/clifford.py +++ b/clifford.py @@ -16,4 +16,3 @@ rp_p1 = 0 rp_pi = 1 rp_m1 = 2 rp_mi = 3 - diff --git a/rightphase.py b/rightphase.py index ddfa9cf..f1e8995 100644 --- a/rightphase.py +++ b/rightphase.py @@ -1,7 +1,11 @@ NAMES = [" ", "i", "-", "-i"] class RightPhase(int): - def __init__(self, phase): - pass + def __new__(cls, value): + return super(TestClass, cls).__new__(cls, value % 4) +a = TestClass(2) +b = TestClass(5) +print a, b +print a+b+b