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.

33 lines
761B

  1. import qi
  2. import numpy as np
  3. import tables
  4. import tqdm
  5. # TODO: ensure that Constraint 1 is met. i.e.
  6. # if C1 is in Z, choose C1' such that it is in Z
  7. table1 = []
  8. table2 = []
  9. bond = qi.cz * np.kron(qi.plus, qi.plus)
  10. no_bond = np.kron(qi.plus, qi.plus)
  11. def find(thing, table):
  12. for index, trial in enumerate(table):
  13. for qq in range(16):
  14. if np.allclose(thing, np.exp(2j*np.pi*qq/16.) * trial):
  15. yield index
  16. for state in bond, no_bond:
  17. for a in tables.unitaries:
  18. for b in tables.unitaries:
  19. state = np.kron(a, b) * state
  20. table1.append(state)
  21. table2.append(qi.cz*state)
  22. for index, thing in enumerate(table2):
  23. print "{} -> {}".format(index, list(find(thing, table1)))