a lot of work on the presentation
17
presentation/example_graphs/circuit_EPR_state.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from collections import deque
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import json
|
||||
|
||||
from pyqcs import State, H, X, S, CZ, CX, list_to_circuit
|
||||
from pyqcs.graph.state import GraphState
|
||||
from pyqcs.util.to_diagram import circuit_to_diagram
|
||||
|
||||
circuit = (H(0)
|
||||
| list_to_circuit([CX(i, 0) for i in range(1, 5)]))
|
||||
|
||||
#circuit = (list_to_circuit([H(i) for i in range(0, 5)])
|
||||
# | list_to_circuit([CZ(i, 0) for i in range(1, 5)])
|
||||
# | list_to_circuit([H(i) for i in range(1, 5)]))
|
||||
|
||||
print(circuit_to_diagram(circuit))
|
||||
BIN
presentation/example_graphs/graph_EPR_state.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
35
presentation/example_graphs/graph_EPR_state.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from collections import deque
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import json
|
||||
|
||||
from pyqcs import State, H, X, S, CZ, list_to_circuit
|
||||
from pyqcs.graph.state import GraphState
|
||||
|
||||
|
||||
circuit_CZ = list_to_circuit([CZ(0, i) for i in range(1, 5)])
|
||||
circuit_H = list_to_circuit([H(i) for i in range(1, 5)])
|
||||
circuit = circuit_CZ | circuit_H
|
||||
|
||||
state = circuit * GraphState.new_plus_state(5)
|
||||
|
||||
vops, edges = state._g_state.to_lists()
|
||||
|
||||
VOP_strs = {0: "H", 2: "I"}
|
||||
|
||||
dot_vertex_str = "\n".join((f"{i} [label=\"{i}, VOP = {VOP_strs[v]}\"]" for i,v in enumerate(vops)))
|
||||
|
||||
handled_edges = set()
|
||||
dot_edges = deque()
|
||||
|
||||
for i, ngbhd in enumerate(edges):
|
||||
for j in ngbhd:
|
||||
if((i,j) not in handled_edges):
|
||||
dot_edges.append(f"{i} -- {j}")
|
||||
handled_edges |= {(i,j), (j,i)}
|
||||
|
||||
dot_edges_str = "\n".join(dot_edges)
|
||||
|
||||
dot_str = "graph graphical_state{\n" + dot_vertex_str + "\n" + dot_edges_str + "\n}"
|
||||
|
||||
print(dot_str)
|
||||
BIN
presentation/example_graphs/graph_apply_CZ.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
35
presentation/example_graphs/graph_apply_CZ.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from collections import deque
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import json
|
||||
|
||||
from pyqcs import State, H, X, S, CZ, list_to_circuit
|
||||
from pyqcs.graph.state import GraphState
|
||||
|
||||
|
||||
circuit_CZ = list_to_circuit([CZ(0, i) for i in range(1, 5)])
|
||||
circuit_H = list_to_circuit([H(i) for i in range(1, 5)])
|
||||
circuit = circuit_CZ | circuit_H | (H(2) | S(2)) | CZ(2, 0)
|
||||
|
||||
state = circuit * GraphState.new_plus_state(5)
|
||||
|
||||
vops, edges = state._g_state.to_lists()
|
||||
|
||||
VOP_strs = {0: "H", 1: "S", 2: "I"}
|
||||
|
||||
dot_vertex_str = "\n".join((f"{i} [label=\"{i}, VOP = {VOP_strs[v]}\"]" for i,v in enumerate(vops)))
|
||||
|
||||
handled_edges = set()
|
||||
dot_edges = deque()
|
||||
|
||||
for i, ngbhd in enumerate(edges):
|
||||
for j in ngbhd:
|
||||
if((i,j) not in handled_edges):
|
||||
dot_edges.append(f"{i} -- {j}")
|
||||
handled_edges |= {(i,j), (j,i)}
|
||||
|
||||
dot_edges_str = "\n".join(dot_edges)
|
||||
|
||||
dot_str = "graph graphical_state{\n" + dot_vertex_str + "\n" + dot_edges_str + "\n}"
|
||||
|
||||
print(dot_str)
|
||||
BIN
presentation/example_graphs/graph_clear_VOPs_CZ_after.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
35
presentation/example_graphs/graph_clear_VOPs_CZ_after.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from collections import deque
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import json
|
||||
|
||||
from pyqcs import State, H, X, S, CZ, list_to_circuit
|
||||
from pyqcs.graph.state import GraphState
|
||||
|
||||
|
||||
circuit_CZ = list_to_circuit([CZ(0, i) for i in range(1, 5)])
|
||||
circuit_H = list_to_circuit([H(i) for i in range(1, 5)])
|
||||
circuit = circuit_CZ | CZ(3, 1) | CZ(2, 4) | circuit_H | CZ(2, 1)
|
||||
|
||||
state = circuit * GraphState.new_plus_state(5)
|
||||
|
||||
vops, edges = state._g_state.to_lists()
|
||||
|
||||
VOP_strs = {0: "H", 1: "S", 2: "I", 3:"HS", 5: "Z"}
|
||||
|
||||
dot_vertex_str = "\n".join((f"{i} [label=\"{i}, VOP = {VOP_strs[v]}\"]" for i,v in enumerate(vops)))
|
||||
|
||||
handled_edges = set()
|
||||
dot_edges = deque()
|
||||
|
||||
for i, ngbhd in enumerate(edges):
|
||||
for j in ngbhd:
|
||||
if((i,j) not in handled_edges):
|
||||
dot_edges.append(f"{i} -- {j}")
|
||||
handled_edges |= {(i,j), (j,i)}
|
||||
|
||||
dot_edges_str = "\n".join(dot_edges)
|
||||
|
||||
dot_str = "graph graphical_state{\n" + dot_vertex_str + "\n" + dot_edges_str + "\n}"
|
||||
|
||||
print(dot_str)
|
||||
BIN
presentation/example_graphs/graph_clear_VOPs_CZ_before.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
35
presentation/example_graphs/graph_clear_VOPs_CZ_before.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from collections import deque
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import json
|
||||
|
||||
from pyqcs import State, H, X, S, CZ, list_to_circuit
|
||||
from pyqcs.graph.state import GraphState
|
||||
|
||||
|
||||
circuit_CZ = list_to_circuit([CZ(0, i) for i in range(1, 5)])
|
||||
circuit_H = list_to_circuit([H(i) for i in range(1, 5)])
|
||||
circuit = circuit_CZ | CZ(3, 1) | CZ(2, 4) | circuit_H# | CZ(2, 1)
|
||||
|
||||
state = circuit * GraphState.new_plus_state(5)
|
||||
|
||||
vops, edges = state._g_state.to_lists()
|
||||
|
||||
VOP_strs = {0: "H", 1: "S", 2: "I", 3:"HS"}
|
||||
|
||||
dot_vertex_str = "\n".join((f"{i} [label=\"{i}, VOP = {VOP_strs[v]}\"]" for i,v in enumerate(vops)))
|
||||
|
||||
handled_edges = set()
|
||||
dot_edges = deque()
|
||||
|
||||
for i, ngbhd in enumerate(edges):
|
||||
for j in ngbhd:
|
||||
if((i,j) not in handled_edges):
|
||||
dot_edges.append(f"{i} -- {j}")
|
||||
handled_edges |= {(i,j), (j,i)}
|
||||
|
||||
dot_edges_str = "\n".join(dot_edges)
|
||||
|
||||
dot_str = "graph graphical_state{\n" + dot_vertex_str + "\n" + dot_edges_str + "\n}"
|
||||
|
||||
print(dot_str)
|
||||
BIN
presentation/example_graphs/graph_clear_VOPs_CZ_cleared.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
35
presentation/example_graphs/graph_clear_VOPs_CZ_cleared.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from collections import deque
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import json
|
||||
|
||||
from pyqcs import State, H, X, S, CZ, list_to_circuit
|
||||
from pyqcs.graph.state import GraphState
|
||||
|
||||
|
||||
circuit_CZ = list_to_circuit([CZ(0, i) for i in range(1, 5)])
|
||||
circuit_H = list_to_circuit([H(i) for i in range(1, 5)])
|
||||
circuit = circuit_CZ | CZ(3, 1) | CZ(2, 4) | circuit_H | CZ(2, 1) | CZ(2, 1)
|
||||
|
||||
state = circuit * GraphState.new_plus_state(5)
|
||||
|
||||
vops, edges = state._g_state.to_lists()
|
||||
|
||||
VOP_strs = {0: "H", 1: "S", 2: "I", 3:"HS", 5: "Z"}
|
||||
|
||||
dot_vertex_str = "\n".join((f"{i} [label=\"{i}, VOP = {VOP_strs[v]}\"]" for i,v in enumerate(vops)))
|
||||
|
||||
handled_edges = set()
|
||||
dot_edges = deque()
|
||||
|
||||
for i, ngbhd in enumerate(edges):
|
||||
for j in ngbhd:
|
||||
if((i,j) not in handled_edges):
|
||||
dot_edges.append(f"{i} -- {j}")
|
||||
handled_edges |= {(i,j), (j,i)}
|
||||
|
||||
dot_edges_str = "\n".join(dot_edges)
|
||||
|
||||
dot_str = "graph graphical_state{\n" + dot_vertex_str + "\n" + dot_edges_str + "\n}"
|
||||
|
||||
print(dot_str)
|
||||
BIN
presentation/example_graphs/graph_two_qbit_CZ_after.png
Normal file
|
After Width: | Height: | Size: 8.2 KiB |
34
presentation/example_graphs/graph_two_qbit_CZ_after.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from collections import deque
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import json
|
||||
|
||||
from pyqcs import State, H, X, S, CZ, list_to_circuit
|
||||
from pyqcs.graph.state import GraphState
|
||||
|
||||
|
||||
circuit = (S(0) | H(1) | S(1) | H(1)) | CZ(0, 1)
|
||||
|
||||
state = circuit * GraphState.new_plus_state(2)
|
||||
|
||||
vops, edges = state._g_state.to_lists()
|
||||
|
||||
VOP_strs = {0: "H", 2: "I", 3: "HS", 12: "HSH", 1: "S"}
|
||||
|
||||
dot_vertex_str = "\n".join((f"{i} [label=\"{i}, VOP = {VOP_strs[v]}\"]" for i,v in enumerate(vops)))
|
||||
|
||||
handled_edges = set()
|
||||
dot_edges = deque()
|
||||
|
||||
for i, ngbhd in enumerate(edges):
|
||||
for j in ngbhd:
|
||||
if((i,j) not in handled_edges):
|
||||
dot_edges.append(f"{i} -- {j}")
|
||||
handled_edges |= {(i,j), (j,i)}
|
||||
|
||||
dot_edges_str = "\n".join(dot_edges)
|
||||
|
||||
dot_str = "graph graphical_state{\n" + dot_vertex_str + "\n" + dot_edges_str + "\n}"
|
||||
|
||||
print(dot_str)
|
||||
|
||||
BIN
presentation/example_graphs/graph_two_qbit_CZ_before.png
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
34
presentation/example_graphs/graph_two_qbit_CZ_before.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from collections import deque
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import json
|
||||
|
||||
from pyqcs import State, H, X, S, CZ, list_to_circuit
|
||||
from pyqcs.graph.state import GraphState
|
||||
|
||||
|
||||
circuit = S(0) | H(1) | S(1) | H(1)
|
||||
|
||||
state = circuit * GraphState.new_plus_state(2)
|
||||
|
||||
vops, edges = state._g_state.to_lists()
|
||||
|
||||
VOP_strs = {0: "H", 2: "I", 3: "HS", 12: "HSH", 1: "S"}
|
||||
|
||||
dot_vertex_str = "\n".join((f"{i} [label=\"{i}, VOP = {VOP_strs[v]}\"]" for i,v in enumerate(vops)))
|
||||
|
||||
handled_edges = set()
|
||||
dot_edges = deque()
|
||||
|
||||
for i, ngbhd in enumerate(edges):
|
||||
for j in ngbhd:
|
||||
if((i,j) not in handled_edges):
|
||||
dot_edges.append(f"{i} -- {j}")
|
||||
handled_edges |= {(i,j), (j,i)}
|
||||
|
||||
dot_edges_str = "\n".join(dot_edges)
|
||||
|
||||
dot_str = "graph graphical_state{\n" + dot_vertex_str + "\n" + dot_edges_str + "\n}"
|
||||
|
||||
print(dot_str)
|
||||
|
||||
BIN
presentation/example_graphs/graph_update_VOP.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
35
presentation/example_graphs/graph_update_VOP.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from collections import deque
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import json
|
||||
|
||||
from pyqcs import State, H, X, S, CZ, list_to_circuit
|
||||
from pyqcs.graph.state import GraphState
|
||||
|
||||
|
||||
circuit_CZ = list_to_circuit([CZ(0, i) for i in range(1, 5)])
|
||||
circuit_H = list_to_circuit([H(i) for i in range(1, 5)])
|
||||
circuit = circuit_CZ | circuit_H | (H(2) | S(2))
|
||||
|
||||
state = circuit * GraphState.new_plus_state(5)
|
||||
|
||||
vops, edges = state._g_state.to_lists()
|
||||
|
||||
VOP_strs = {0: "H", 1: "S", 2: "I"}
|
||||
|
||||
dot_vertex_str = "\n".join((f"{i} [label=\"{i}, VOP = {VOP_strs[v]}\"]" for i,v in enumerate(vops)))
|
||||
|
||||
handled_edges = set()
|
||||
dot_edges = deque()
|
||||
|
||||
for i, ngbhd in enumerate(edges):
|
||||
for j in ngbhd:
|
||||
if((i,j) not in handled_edges):
|
||||
dot_edges.append(f"{i} -- {j}")
|
||||
handled_edges |= {(i,j), (j,i)}
|
||||
|
||||
dot_edges_str = "\n".join(dot_edges)
|
||||
|
||||
dot_str = "graph graphical_state{\n" + dot_vertex_str + "\n" + dot_edges_str + "\n}"
|
||||
|
||||
print(dot_str)
|
||||