Anders and Briegel in Python
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
887B

  1. from abp import GraphState, clifford
  2. from anders_briegel import graphsim
  3. import numpy as np
  4. from tqdm import tqdm
  5. import itertools as it
  6. import dummy
  7. from config import *
  8. N = 10
  9. m = {1: graphsim.lco_X, 2: graphsim.lco_Y, 3: graphsim.lco_Z}
  10. def test_1():
  11. """ Check that single qubits work """
  12. space = it.product(range(24), (3,2,1), (0,1))
  13. for rotation, measurement, outcome in tqdm(space, "Testing single qubit measurements"):
  14. #print "\nr{} m{} o{}".format(rotation, measurement, outcome)
  15. a, b = dummy.onequbit()
  16. #print a.to_json()["node"][0]["vop"], b.to_json()["node"][0]["vop"]
  17. a.measure(0, str(measurement), outcome)
  18. b.measure(0, m[measurement], None, outcome)
  19. #print a.to_json()["node"][0]["vop"], b.to_json()["node"][0]["vop"]
  20. assert a == b, (a.to_json()["node"][0], b.to_json()["node"][0])