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.

44 lines
1.8KB

  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. from tqdm import tqdm
  14. def find_up_to_phase(u):
  15. """ Find the index of a given u within a list of unitaries, up to a global phase """
  16. global unitaries
  17. for i, t in enumerate(unitaries):
  18. for phase in range(8):
  19. if allclose(t, exp(1j*phase*pi/4.)*u):
  20. return i, phase
  21. raise IndexError
  22. def construct_tables():
  23. """ Constructs multiplication and conjugation tables """
  24. permutations = (id, ha, ph, ha*ph, ha*ph*ha, ha*ph*ha*ph)
  25. signs = (id, px, py, pz)
  26. unitaries = [p*s for p in permutations for s in signs]
  27. conjugation_table = [find_up_to_phase(u.H)[0] for i, u in enumerate(unitaries)]
  28. times_table = [[find_up_to_phase(u*v)[0] for v in unitaries]
  29. for u in tqdm(unitaries, "Building times-table")]
  30. id = matrix(eye(2, dtype=complex))
  31. px = matrix([[0, 1], [1, 0]], dtype=complex)
  32. py = matrix([[0, -1j], [1j, 0]], dtype=complex)
  33. pz = matrix([[1, 0], [0, -1]], dtype=complex)
  34. ha = matrix([[1, 1], [1, -1]], dtype=complex) / sqrt(2)
  35. ph = matrix([[1, 0], [0, 1j]], dtype=complex)