Browse Source

Adding stabilizers

master
Pete Shadbolt 7 years ago
parent
commit
552d8576ed
2 changed files with 18 additions and 15 deletions
  1. +0
    -15
      abp/graphstate.py
  2. +18
    -0
      abp/stabilizer.py

+ 0
- 15
abp/graphstate.py View File

@@ -401,21 +401,6 @@ class GraphState(object):
state.act_local_rotation(mapping[i], clifford.unitaries[n["vop"]])
return state

def to_stabilizer(self):
""" Get the stabilizer tableau. Work in progress!
"""
return
output = {a: {} for a in self.node}
for a, b in it.product(self.node, self.node):
if a == b:
output[a][b] = "X"
elif a in self.adj[b]:
output[a][b] = "Z"
else:
output[a][b] = "I"
# TODO: signs
return output

def __eq__(self, other):
""" Check equality between GraphStates """
return self.adj == other.adj and self.node == other.node


+ 18
- 0
abp/stabilizer.py View File

@@ -0,0 +1,18 @@
class Stabilizer(object):
def __init__(self, g):
""" Construct a Stabilizer from a Graphstate """
pass

def to_stabilizer(self):
""" Get the stabilizer tableau. Work in progress!
"""
for a, b in it.product(self.node, self.node):
output[a]["sign"] = 1
if a == b:
output[a][b] = "X"
elif a in self.adj[b]:
output[a][b] = "Z"
else:
output[a][b] = "I"
return output


Loading…
Cancel
Save