From 13b15c5e3f21a462cfce703930d1adf54f491a3e Mon Sep 17 00:00:00 2001 From: Pete Shadbolt Date: Tue, 16 Feb 2016 23:06:30 +0000 Subject: [PATCH] Test passing --- abp.py | 22 ++++------------------ loccliff.py | 10 ++++++++++ rightphase.py | 7 +++++++ tests/test_graph.py | 2 +- tests/test_loccliff.py | 6 ++++++ tests/test_rightphase.py | 6 ++++++ 6 files changed, 34 insertions(+), 19 deletions(-) create mode 100644 loccliff.py create mode 100644 rightphase.py create mode 100644 tests/test_loccliff.py create mode 100644 tests/test_rightphase.py diff --git a/abp.py b/abp.py index 9ec8e8d..4ef7ede 100644 --- a/abp.py +++ b/abp.py @@ -1,25 +1,11 @@ from clifford import * +from rightphase import RightPhase """ Porting Anders and Briegel to Python """ -stab_rep = {None: "-", 0: "X", 1: "Y", 2: "Z"} - - -class RightPhase(object): - - def __init__(self, phase): - self.phase = phase % 4 - - def conjugate - - -class LocalOperator(object): - - def __init__(self): - pass - +stab_rep = {None: "-", 0: "I", 1: "X", 2: "Y", 3:"Z"} class Stabilizer(object): @@ -33,12 +19,12 @@ class Stabilizer(object): for j in range(n): if i == j: self.paulis[i][j] = lco_x - elif j in g.vertices[i].neighbors: + elif j in graph.vertices[i].neighbors: self.paulis[i][j] = lco_z 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] + \ diff --git a/loccliff.py b/loccliff.py new file mode 100644 index 0000000..1d8add6 --- /dev/null +++ b/loccliff.py @@ -0,0 +1,10 @@ +NAMES = [" ", "i", "-", "-i"] + +class RightPhase(int): + def __init__(self, phase): + self.ph = phase % 4 + + def get_name(self): + return NAMES[self.ph] + + diff --git a/rightphase.py b/rightphase.py new file mode 100644 index 0000000..ddfa9cf --- /dev/null +++ b/rightphase.py @@ -0,0 +1,7 @@ +NAMES = [" ", "i", "-", "-i"] + +class RightPhase(int): + def __init__(self, phase): + pass + + diff --git a/tests/test_graph.py b/tests/test_graph.py index 7d33410..e498a74 100644 --- a/tests/test_graph.py +++ b/tests/test_graph.py @@ -24,5 +24,5 @@ def setup_stab(): @with_setup(setup_stab) def test_adding(): s = abp.Stabilizer(g) - print s + diff --git a/tests/test_loccliff.py b/tests/test_loccliff.py new file mode 100644 index 0000000..7962217 --- /dev/null +++ b/tests/test_loccliff.py @@ -0,0 +1,6 @@ +from nose import with_setup +import loccliff + +def test_loccliff(): + pass + diff --git a/tests/test_rightphase.py b/tests/test_rightphase.py new file mode 100644 index 0000000..6da3b60 --- /dev/null +++ b/tests/test_rightphase.py @@ -0,0 +1,6 @@ +from nose import with_setup +from rightphase import RightPhase + +def test_rightphase(): + assert RightPhase(4) == 4 +