diff --git a/abp/graphstate.py b/abp/graphstate.py index b87b2fc..b2e7bb9 100644 --- a/abp/graphstate.py +++ b/abp/graphstate.py @@ -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 diff --git a/abp/stabilizer.py b/abp/stabilizer.py new file mode 100644 index 0000000..6c4f02d --- /dev/null +++ b/abp/stabilizer.py @@ -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 +