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.

29 lines
866B

  1. import clifford as lc
  2. from numpy import *
  3. def test_identify_pauli():
  4. assert lc.identify_pauli(lc.px) == (1, "x")
  5. assert lc.identify_pauli(-lc.px) == (-1, "x")
  6. assert lc.identify_pauli(-lc.pz) == (-1, "z")
  7. def test_against_anders_table():
  8. assert allclose(lc.vop_unitaries[0], lc.i)
  9. assert allclose(lc.vop_unitaries[10], lc.h)
  10. yb = matrix([[1,0],[0,1j]])
  11. assert allclose(lc.vop_unitaries[5], yb)
  12. xb = matrix([[1,0],[0,-1j]])
  13. assert allclose(lc.vop_unitaries[6], xb)
  14. #ye = matrix([[1,-1j],[-1,-1j]])/sqrt(2)
  15. #print lc.vop_unitaries[17]
  16. #print ye
  17. #assert allclose(lc.vop_unitaries[17], ye)
  18. u = exp(-1j*pi/4)*matrix([[0,1],[1j,0]])
  19. print lc.format_action(lc.identify_pauli(u*p*u.H) for p in lc.paulis)
  20. u = lc.vop_unitaries[4]
  21. print lc.format_action(lc.identify_pauli(u*p*u.H) for p in lc.paulis)