瀏覽代碼

Remove adj_list()

master
Pete Shadbolt 8 年之前
父節點
當前提交
e398d39aae
共有 2 個檔案被更改,包括 10 行新增10 行删除
  1. +0
    -10
      abp/graphstate.py
  2. +10
    -0
      tests/test_measurement.py

+ 0
- 10
abp/graphstate.py 查看文件

@@ -191,16 +191,6 @@ class GraphState(object):
output[a][b] = "I"
return output

def adj_list(self):
""" For comparison with Anders and Briegel's C++ implementation """
rows = []
for key, node in self.node.items():
adj = " ".join(map(str, sorted(self.adj[key])))
vop = clifford.get_name(node["vop"])
s = "Vertex {}: VOp {}, neighbors {}".format(key, vop, adj)
rows.append(s)
return " \n".join(rows) + " \n"

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

+ 10
- 0
tests/test_measurement.py 查看文件

@@ -1,4 +1,5 @@
from abp import GraphState
from anders_briegel import graphsim

def test_z_measurement():
g = GraphState([0])
@@ -6,5 +7,14 @@ def test_z_measurement():
assert g.measure_z(0, 1) == 1


def test_z_measurement_against_ab():
a = graphsim.GraphRegister(1)
b = GraphState()
b.add_node(0)

print a.measure(0, graphsim.lco_Z)
print b.measure_z(0)





Loading…
取消
儲存