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.

local_cliffords.py 2.5KB

пре 8 година
пре 8 година
пре 8 година
пре 8 година
пре 8 година
пре 8 година
пре 8 година
пре 8 година
пре 8 година
пре 8 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. """
  4. Generates and enumerates the 24 elements of the local Clifford group
  5. Following the prescription of Anders (thesis pg. 26):
  6. > Table 2.1: The 24 elements of the local Clifford group. The row index (here called the “sign symbol”) shows how the operator
  7. > U permutes the Pauli operators σ = X, Y, Z under the conjugation σ = ±UσU† . The column index (the “permutation
  8. > symbol”) indicates the sign obtained under the conjugation: For operators U in the I column it is the sign of the permutation
  9. > (indicated on the left). For elements in the X, Y and Z columns, it is this sign only if the conjugated Pauli operator is the one
  10. > indicated by the column header and the opposite sign otherwise.
  11. """
  12. # TODO:
  13. # - check that we re-generate the table
  14. # - sort of re-map to an ordering
  15. # - do conjugation
  16. # - do times table
  17. # - write tests
  18. from numpy import *
  19. def identify_pauli(m):
  20. """ Given a signed Pauli matrix, name it. """
  21. for sign in (+1, -1):
  22. for pauli_label, pauli in zip("xyz", paulis):
  23. if allclose(sign*pauli, m):
  24. return sign, pauli_label
  25. def anders_sign_rule(sign, column, p):
  26. """ Anders' sign rule from thesis """
  27. return sign if (p==column or column=="i") else -sign, p
  28. def format_action(action):
  29. return "".join("{}{}".format("+" if s>=0 else "-", p) for s, p in action)
  30. # Some two-qubit matrices
  31. i = matrix(eye(2, dtype=complex))
  32. px = matrix([[0, 1], [1, 0]], dtype=complex)
  33. py = matrix([[0, -1j], [1j, 0]], dtype=complex)
  34. pz = matrix([[1, 0], [0, -1]], dtype=complex)
  35. h = matrix([[1, 1], [1, -1]], dtype=complex) / sqrt(2)
  36. p = matrix([[1, 0], [0, 1j]], dtype=complex)
  37. paulis = (px, py, pz)
  38. # More two-qubit matrices
  39. s_rotations = [i, p, p*p, p*p*p]
  40. s_names = ["i", "p", "pp", "ppp"]
  41. c_rotations = [i, h, h*p, h*p*p, h*p*p*p, h*p*p*h]
  42. c_names = ["i", "h", "hp", "hpp", "hppp", "hpph"]
  43. # Build the table of VOPs according to Anders (verbatim from thesis)
  44. table = (("a", "xyz", +1), ("b", "yxz", -1), ("c", "zyx", -1),
  45. ("d", "xzy", -1), ("e", "yxz", +1), ("f", "zxy", +1))
  46. for label, permutation, sign in table:
  47. for column, operator in zip("ixyz", "i"+permutation):
  48. effect = [anders_sign_rule(sign, column, p) for p in "xyz"]
  49. print label+operator, format_action(effect)
  50. for s, sn in zip(s_rotations, s_names):
  51. for c, cn in zip(c_rotations, c_names):
  52. u = s*c
  53. action = tuple(identify_pauli(u*p*u.H) for p in paulis)
  54. print cn, sn, format_action(action)