|
@@ -12,6 +12,7 @@ from functools import reduce |
|
|
from util import cache_to_disk |
|
|
from util import cache_to_disk |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: make this more efficient / shorter |
|
|
def find_up_to_phase(u): |
|
|
def find_up_to_phase(u): |
|
|
""" Find the index of a given u within a list of unitaries, up to a global phase """ |
|
|
""" Find the index of a given u within a list of unitaries, up to a global phase """ |
|
|
for i, t in enumerate(unitaries): |
|
|
for i, t in enumerate(unitaries): |
|
@@ -44,9 +45,13 @@ decompositions = ("xxxx", "xx", "zzxx", "zz", "zxx", "z", "zzz", "xxz", |
|
|
elements = {"x": qi.sqx, "z": qi.msqz} |
|
|
elements = {"x": qi.sqx, "z": qi.msqz} |
|
|
unitaries = [compose_u(d) for d in decompositions] |
|
|
unitaries = [compose_u(d) for d in decompositions] |
|
|
conjugation_table, times_table = construct_tables() |
|
|
conjugation_table, times_table = construct_tables() |
|
|
|
|
|
|
|
|
|
|
|
# TODO: generate these global names automatically via search |
|
|
sqx = 15 |
|
|
sqx = 15 |
|
|
msqz = 5 |
|
|
msqz = 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
if __name__ == '__main__': |
|
|
print find_up_to_phase(qi.sqx) |
|
|
print find_up_to_phase(qi.sqx) |
|
|
print find_up_to_phase(qi.msqz) |
|
|
print find_up_to_phase(qi.msqz) |
|
|