Anders and Briegel in Python
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

29 řádky
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}