Anders and Briegel in Python
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

49 lignes
1.3KB

  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. #def test_some_anders():
  19. #u = matrix([[1,0],[0,1j]])
  20. #print u
  21. #print lc.format_action(lc.get_action(u))
  22. #print lc.vop_by_name["xb"]
  23. #u = matrix([[1,0],[0,0-1j]])
  24. #print u
  25. #print lc.format_action(lc.get_action(u))
  26. #print lc.vop_by_name["yb"]
  27. #def _test_anders_problem():
  28. #bi = lc.vop_by_name["bi"]
  29. #print bi["name"]
  30. #print bi["action"]
  31. #print bi["unitary"]
  32. #u = exp(-1j*pi/4)*matrix([[0,1],[1j,0]])
  33. #print u
  34. #print lc.format_action(lc.get_action(u))
  35. #print lc.format_action(lc.identify_pauli(u*p*u.H) for p in lc.paulis)
  36. #u = lc.vop_unitaries[4]
  37. #print lc.format_action(lc.identify_pauli(u*p*u.H) for p in lc.paulis)