Anders and Briegel in Python
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

29 linhas
781B

  1. # -*- coding: utf-8 -*-
  2. """
  3. This program generates and caches lookup tables, and handles the Clifford group.
  4. It provides tables for Clifford group multiplication and conjugation,
  5. as well as CZ and decompositions of the 2x2 Cliffords.
  6. """
  7. from tables import *
  8. def conjugate(operator, unitary):
  9. """ Returns transform * vop * transform^dagger and a phase in {+1, -1} """
  10. return measurement_table[operator, unitary]
  11. def use_old_cz():
  12. """ Use the CZ table from A&B's code """
  13. global cz_table
  14. from anders_cz import cz_table
  15. def get_name(i):
  16. """ Get the human-readable name of this clifford """
  17. return "IXYZ"[i & 0x03] + "ABCDEF"[i / 4]
  18. def is_diagonal(v):
  19. """ TODO: remove this. Checks if a VOP is diagonal or not """
  20. return v in {0, 3, 5, 6}