a lot of work on the presentation

This commit is contained in:
2020-04-15 16:02:38 +02:00
parent c4c5e88b8f
commit 91577ef2b6
19 changed files with 476 additions and 299 deletions

View 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))

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View 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)