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.

test_stabilizer.py 679B

123456789101112131415161718192021222324
  1. from abp import GraphState
  2. from tqdm import tqdm
  3. import mock
  4. REPEATS = 1000
  5. def test_stabilizers_against_anders_and_briegel(n=10):
  6. """ Test that stabilizers are line-for-line equivalent """
  7. for i in tqdm(list(range(REPEATS)), "Stabilizer representation VS A&B"):
  8. c = mock.random_stabilizer_circuit(n)
  9. g = mock.AndersWrapper(list(range(n)))
  10. g.act_circuit(c)
  11. da = g.get_full_stabilizer().to_dictionary()
  12. g = mock.ABPWrapper(list(range(n)))
  13. g.act_circuit(c)
  14. db = g.to_stabilizer().to_dictionary()
  15. assert da == db
  16. def test_stabilizer_access():
  17. g = GraphState(3)
  18. print(g.to_stabilizer()[0, 0])