Browse Source

Test passing

master
Pete Shadbolt 8 years ago
parent
commit
13b15c5e3f
6 changed files with 34 additions and 19 deletions
  1. +4
    -18
      abp.py
  2. +10
    -0
      loccliff.py
  3. +7
    -0
      rightphase.py
  4. +1
    -1
      tests/test_graph.py
  5. +6
    -0
      tests/test_loccliff.py
  6. +6
    -0
      tests/test_rightphase.py

+ 4
- 18
abp.py View File

@@ -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] + \


+ 10
- 0
loccliff.py View File

@@ -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]



+ 7
- 0
rightphase.py View File

@@ -0,0 +1,7 @@
NAMES = [" ", "i", "-", "-i"]

class RightPhase(int):
def __init__(self, phase):
pass



+ 1
- 1
tests/test_graph.py View File

@@ -24,5 +24,5 @@ def setup_stab():
@with_setup(setup_stab)
def test_adding():
s = abp.Stabilizer(g)
print s


+ 6
- 0
tests/test_loccliff.py View File

@@ -0,0 +1,6 @@
from nose import with_setup
import loccliff

def test_loccliff():
pass


+ 6
- 0
tests/test_rightphase.py View File

@@ -0,0 +1,6 @@
from nose import with_setup
from rightphase import RightPhase

def test_rightphase():
assert RightPhase(4) == 4


Loading…
Cancel
Save