Anders and Briegel in Python
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

23 wiersze
845B

  1. from anders_briegel import graphsim
  2. from abp import clifford
  3. import itertools
  4. #//! replaces op by trans * op * trans^dagger and returns a phase,
  5. #/*! either +1 or -1 (as RightPhase(0) or RightPhase(2)) */
  6. #RightPhase conjugate (const LocCliffOp trans);
  7. def test_conjugation():
  8. """ Test that clifford.conugate() agrees with graphsim.LocCliffOp.conjugate """
  9. for operation_index, transform_index in itertools.product(range(4), range(24)):
  10. transform = graphsim.LocCliffOp(transform_index)
  11. operation = graphsim.LocCliffOp(operation_index)
  12. phase = operation.conjugate(transform).ph
  13. phase = [1, 0, -1][phase]
  14. new_operation = operation.op
  15. NEW_OPERATION, PHASE = clifford.conjugate(operation_index, transform_index)
  16. assert new_operation == NEW_OPERATION
  17. assert PHASE == phase