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.

26 lines
658B

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