Anders and Briegel in Python
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

49 satır
1.6KB

  1. from numpy import *
  2. import clifford as lc
  3. r = exp(-1j*pi/4)
  4. ir2 = 1/sqrt(2)
  5. anders = [
  6. matrix([[1, 0], [0, 1]], dtype=complex),
  7. matrix([[0, 1], [1, 0]], dtype=complex),
  8. matrix([[0, -1j], [1j, 0]], dtype=complex),
  9. matrix([[1, 0], [0, -1]], dtype=complex),
  10. \
  11. r * matrix([[0, 1], [1j, 0]], dtype=complex),
  12. matrix([[1, 0], [0, 1j]], dtype=complex),
  13. matrix([[1, 0], [0, -1j]], dtype=complex),
  14. r * matrix([[0, 1], [-1j, 0]], dtype=complex),
  15. \
  16. ir2 * matrix([[1,-1],[-1,-1]], dtype=complex),
  17. ir2 * matrix([[1,-1],[1,1]], dtype=complex),
  18. ir2 * matrix([[1,1],[1,-1]], dtype=complex),
  19. ir2 * matrix([[1,1],[-1,1]], dtype=complex),
  20. \
  21. ir2 * matrix([[1,-1j],[1j,-1]], dtype=complex),
  22. ir2 * matrix([[1,1j],[-1j,-1]], dtype=complex),
  23. ir2 * matrix([[1,-1j],[-1j,1]], dtype=complex),
  24. ir2 * matrix([[1,1j],[1j,1]], dtype=complex),
  25. \
  26. ir2 * matrix([[1,1j],[1,-1j]], dtype=complex),
  27. ir2 * matrix([[1,-1j],[-1,-1j]], dtype=complex),
  28. ir2 * matrix([[1,1j],[-1,1j]], dtype=complex),
  29. ir2 * matrix([[1,-1j],[1,1j]], dtype=complex),
  30. \
  31. ir2 * matrix([[1,1],[-1j,1j]], dtype=complex),
  32. ir2 * matrix([[1,1],[1j,-1j]], dtype=complex),
  33. ir2 * matrix([[1,-1],[1j,1j]], dtype=complex),
  34. ir2 * matrix([[1,-1],[-1j,-1j]], dtype=complex),
  35. ]
  36. def test_everything():
  37. for i, (a, b) in enumerate(zip(lc.vop_actions, anders)):
  38. a2 = lc.format_action(lc.get_action(b))
  39. if i %4==0:
  40. print
  41. print "({} {})".format(a, a2),
  42. #if not any([allclose(a, x) for x in anders]):
  43. #print lc.vop_gates[i], "is not in {anders}"