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.

49 lines
1.7KB

  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. from numpy import *
  13. def find_up_to_phase(u):
  14. """ Find the index of a given u within a list of unitaries, up to a global phase """
  15. global unitaries
  16. for i, t in enumerate(unitaries):
  17. for phase in range(8):
  18. if allclose(t, exp(1j*phase*pi/4.)*u):
  19. return i, phase
  20. raise IndexError
  21. id = matrix(eye(2, dtype=complex))
  22. px = matrix([[0, 1], [1, 0]], dtype=complex)
  23. py = matrix([[0, -1j], [1j, 0]], dtype=complex)
  24. pz = matrix([[1, 0], [0, -1]], dtype=complex)
  25. ha = matrix([[1, 1], [1, -1]], dtype=complex) / sqrt(2)
  26. ph= matrix([[1, 0], [0, 1j]], dtype=complex)
  27. permutations = (id, ha, ph, ha*ph, ha*ph*ha, ha*ph*ha*ph)
  28. signs = (id, px, py, pz)
  29. unitaries = [p*s for p in permutations for s in signs]
  30. conjugation_table = []
  31. for i, u in enumerate(unitaries):
  32. i, phase = find_up_to_phase(u.H)
  33. conjugation_table.append(i)
  34. # TODO:
  35. # - check that we re-generate the table
  36. # - do conjugation
  37. # - do times table
  38. # - write tests