Browse Source

Gonna go from scratch

master
Pete Shadbolt 8 years ago
parent
commit
75e4836fde
3 changed files with 10 additions and 8 deletions
  1. +4
    -5
      abp.py
  2. +0
    -1
      clifford.py
  3. +6
    -2
      rightphase.py

+ 4
- 5
abp.py View File

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


+ 0
- 1
clifford.py View File

@@ -16,4 +16,3 @@ rp_p1 = 0
rp_pi = 1
rp_m1 = 2
rp_mi = 3


+ 6
- 2
rightphase.py View File

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


Loading…
Cancel
Save