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.

32 lines
735B

  1. from abp import GraphState, clifford
  2. from anders_briegel import graphsim
  3. import numpy as np
  4. from tqdm import tqdm
  5. import dummy
  6. N = 2
  7. REPEATS = 10
  8. PZ = graphsim.lco_Z
  9. def _test_multiqubit_measurement_pz():
  10. """ Test a multiqubit measurement """
  11. for i in tqdm(range(REPEATS)):
  12. a, b = dummy.random_state(messy=False)
  13. j = np.random.choice(range(N))
  14. k = "pz"
  15. a.measure(j, k, 0)
  16. print a.to_json()
  17. print b.to_json()
  18. print
  19. #assert a.to_json() == b.to_json(), a
  20. def test_multiqubit_pz():
  21. for i in range(10):
  22. a, b = dummy.bell()
  23. assert a == b
  24. print a.measure(0, "pz", 1)
  25. print b.measure(0, PZ, None, 1)
  26. assert a == b