@@ -103,7 +103,7 @@ if __name__ == "__main__": | |||||
by_name = get_by_name(unitaries) | by_name = get_by_name(unitaries) | ||||
conjugation_table = get_conjugation_table(unitaries) | conjugation_table = get_conjugation_table(unitaries) | ||||
times_table = get_times_table(unitaries) | times_table = get_times_table(unitaries) | ||||
#cz_table = get_cz_table(unitaries) | |||||
# cz_table = get_cz_table(unitaries) | |||||
# Write it all to disk | # Write it all to disk | ||||
directory = os.path.dirname(os.path.abspath(__file__)) | directory = os.path.dirname(os.path.abspath(__file__)) | ||||
@@ -112,8 +112,7 @@ if __name__ == "__main__": | |||||
np.save("unitaries.npy", unitaries) | np.save("unitaries.npy", unitaries) | ||||
np.save("conjugation_table.npy", conjugation_table) | np.save("conjugation_table.npy", conjugation_table) | ||||
np.save("times_table.npy", times_table) | np.save("times_table.npy", times_table) | ||||
#np.save("cz_table.npy", cz_table) | |||||
# np.save("cz_table.npy", cz_table) | |||||
with open("by_name.json", "wb") as f: | with open("by_name.json", "wb") as f: | ||||
json.dump(by_name, f) | json.dump(by_name, f) | ||||
@@ -0,0 +1 @@ | |||||
{"sqz": 6, "sqy": 11, "sqx": 15, "pz": 3, "px": 1, "py": 2, "hadamard": 10, "phase": 5, "msqz": 5, "msqy": 9, "msqx": 14, "identity": 0} |
@@ -17,7 +17,8 @@ def draw(state, filename="out.pdf", pos=None, ns=500): | |||||
nx.draw_networkx_edges(graph, pos, edge_color="gray") | nx.draw_networkx_edges(graph, pos, edge_color="gray") | ||||
nx.draw_networkx_labels(graph, pos, font_family="FreeSans") | nx.draw_networkx_labels(graph, pos, font_family="FreeSans") | ||||
labels = {i: tables.name_of(v) for i, v in state.vops.items()} | |||||
# tables.name_of(v) | |||||
labels = {i: "no name" for i, v in state.vops.items()} | |||||
pos = {k: v + np.array([0, -.1]) for k, v in pos.items()} | pos = {k: v + np.array([0, -.1]) for k, v in pos.items()} | ||||
nx.draw_networkx_labels(graph, pos, labels, font_family="FreeSans") | nx.draw_networkx_labels(graph, pos, labels, font_family="FreeSans") | ||||
plt.axis('off') | plt.axis('off') | ||||
@@ -1,5 +1,5 @@ | |||||
from graph import GraphState | |||||
import viz | |||||
from abp.graph import GraphState | |||||
from abp import viz | |||||
def test_viz(): | def test_viz(): | ||||