Anders and Briegel in Python
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

test_single_qubit_measurement_against_anb.py 887B

8年前
8年前
1234567891011121314151617181920212223
  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])