Browse Source

Update example

master
Pete Shadbolt 8 years ago
parent
commit
86bc79156a
1 changed files with 2 additions and 21 deletions
  1. +2
    -21
      examples/mercedes_demo.py

+ 2
- 21
examples/mercedes_demo.py View File

@@ -3,7 +3,7 @@ import abp
from abp.util import xyz from abp.util import xyz


def linear_cluster(n): def linear_cluster(n):
g = FGS(range(n), deterministic=True)
g = FGS(range(n), deterministic=False)
g.act_circuit([(i, "hadamard") for i in range(n)]) g.act_circuit([(i, "hadamard") for i in range(n)])
g.act_circuit([((i, i+1), "cz") for i in range(n-1)]) g.act_circuit([((i, i+1), "cz") for i in range(n-1)])
return g return g
@@ -13,30 +13,11 @@ def test_mercedes_example_1():
""" Run an example provided by mercedes """ """ Run an example provided by mercedes """


g = linear_cluster(5) g = linear_cluster(5)
g.measure(2, "px", 1)
g.measure(3, "px", 1) g.measure(3, "px", 1)
g.measure(2, "px", 0)
g.remove_nodes_from((2, 3))
print g.node

g = linear_cluster(5)
g.measure(2, "px", 0)
g.measure(3, "px", 0)
g.remove_vop(0, 1) g.remove_vop(0, 1)
g.remove_vop(1, 0) g.remove_vop(1, 0)
g.remove_nodes_from((2, 3))
a = g.to_state_vector()
print g.node print g.node


g = linear_cluster(5)
g.measure(2, "px", 0)
g.measure(3, "px", 1)
g.remove_vop(0, 1)
g.remove_vop(1, 0)
g.remove_nodes_from((2, 3))
b = g.to_state_vector()
print g.node







Loading…
Cancel
Save