Anders and Briegel in Python
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
486B

  1. from abp import GraphState
  2. from abp.util import xyz
  3. def linear_cluster(n):
  4. g = GraphState(range(n))
  5. g.act_circuit([(i, "hadamard") for i in range(n)])
  6. g.act_circuit([((i, i+1), "cz") for i in range(n-1)])
  7. return g
  8. def test_mercedes_example_1():
  9. """ Run an example provided by mercedes """
  10. g = linear_cluster(5)
  11. g.measure(3, "px")
  12. g.measure(2, "px")
  13. assert set(g.adj[0]) == {1}
  14. assert set(g.adj[1]) == {0, 4}
  15. assert set(g.adj[4]) == {1}