@@ -416,12 +416,12 @@ class GraphState(object): | |||||
>>> print g.to_stabilizer() | >>> print g.to_stabilizer() | ||||
0 1 2 3 100 200 | 0 1 2 3 100 200 | ||||
------------------------------ | ------------------------------ | ||||
X Z Z X I I | |||||
Z X Z I I I | |||||
Z Z X I I I | |||||
- Z I I Z I I | |||||
I I I I X Z | |||||
I I I I Z X | |||||
X Z Z X | |||||
Z X Z | |||||
Z Z X | |||||
- Z Z | |||||
X Z | |||||
Z X | |||||
""" | """ | ||||
return Stabilizer(self) | return Stabilizer(self) | ||||
@@ -44,7 +44,7 @@ class Stabilizer(object): | |||||
sign = self.phases[i] | sign = self.phases[i] | ||||
sign = {1: " ", -1: " -", 1j: " i", -1j: "-i"}[sign] | sign = {1: " ", -1: " -", 1j: " i", -1j: "-i"}[sign] | ||||
row = (self.tableau[i][j] for j in sorted(self.phases)) | row = (self.tableau[i][j] for j in sorted(self.phases)) | ||||
row = ("IXYZ"[i].ljust(w) for i in row) | |||||
row = (" XYZ"[i].ljust(w) for i in row) | |||||
row = " ".join(row) | row = " ".join(row) | ||||
s += "{} {}\n".format(sign, row) | s += "{} {}\n".format(sign, row) | ||||
return s | return s | ||||
@@ -0,0 +1,11 @@ | |||||
from abp import GraphState | |||||
edges = (0, 1), (1, 2), (2, 0), (0, 3), (100, 200) | |||||
g = GraphState([0, 1, 2, 3, 100, 200]) | |||||
g.act_circuit((i, "hadamard") for i in g.node) | |||||
g.act_circuit((edge, "cz") for edge in edges) | |||||
g.act_local_rotation(3, 9) | |||||
print g.to_stabilizer() | |||||