some restructuring here; might not work

This commit is contained in:
Daniel Knüttel 2020-03-16 12:16:13 +01:00
parent 1701b480f0
commit 1b4702f8ff
6 changed files with 34 additions and 29 deletions

View File

@ -1 +0,0 @@
{"nstart": 4, "nstop": 1200, "step": 50, "ncircuits": 100, "nqbits0": 35, "seed": 3735928559}

View File

@ -1,24 +0,0 @@
4.000000000000000000e+00 1.000000000000000000e+02 1.564543006679741774e-05 2.656992883057296882e-08
5.400000000000000000e+01 1.000000000000000000e+02 1.731588100665248974e-04 1.891486708526498503e-07
1.040000000000000000e+02 1.000000000000000000e+02 3.327573901151481789e-04 1.855951227204178612e-07
1.540000000000000000e+02 1.000000000000000000e+02 4.930128000341937617e-04 2.744376670026742635e-07
2.040000000000000000e+02 1.000000000000000000e+02 6.546214299487473735e-04 5.883677983588543225e-07
2.540000000000000000e+02 1.000000000000000000e+02 8.212220899258682169e-04 1.126278112692182968e-06
3.040000000000000000e+02 1.000000000000000000e+02 1.015626240023266395e-03 3.254998559417442113e-06
3.540000000000000000e+02 1.000000000000000000e+02 1.220751460041356092e-03 5.651673945840259503e-06
4.040000000000000000e+02 1.000000000000000000e+02 1.469789179991494140e-03 1.230198810360312458e-05
4.540000000000000000e+02 1.000000000000000000e+02 1.757790079973346915e-03 1.897676531720800632e-05
5.040000000000000000e+02 1.000000000000000000e+02 2.089055169981293182e-03 2.956743840878384134e-05
5.540000000000000000e+02 1.000000000000000000e+02 2.498453950011025881e-03 3.814927536558484350e-05
6.040000000000000000e+02 1.000000000000000000e+02 3.009637379891500972e-03 5.073452290883979660e-05
6.540000000000000000e+02 1.000000000000000000e+02 3.482909410031425224e-03 6.954956500888895342e-05
7.040000000000000000e+02 1.000000000000000000e+02 4.206959059865766556e-03 7.551001508640306091e-05
7.540000000000000000e+02 1.000000000000000000e+02 4.908434529970691178e-03 7.480130306974699657e-05
8.040000000000000000e+02 1.000000000000000000e+02 5.724250219900568412e-03 9.401443578256306875e-05
8.540000000000000000e+02 1.000000000000000000e+02 6.402010290075850138e-03 9.696758969498020585e-05
9.040000000000000000e+02 1.000000000000000000e+02 7.130309890017088280e-03 1.214294101579835105e-04
9.540000000000000000e+02 1.000000000000000000e+02 8.238475820107851733e-03 1.317346528726986619e-04
1.004000000000000000e+03 1.000000000000000000e+02 9.108648289948178753e-03 1.116290141071140209e-04
1.054000000000000000e+03 1.000000000000000000e+02 1.004816869981368585e-02 1.294641140653965384e-04
1.104000000000000000e+03 1.000000000000000000e+02 1.081924826003160048e-02 1.313532735861817728e-04
1.154000000000000000e+03 1.000000000000000000e+02 1.177285703000961747e-02 1.599152765896968953e-04
1 4.000000000000000000e+00 1.000000000000000000e+02 1.564543006679741774e-05 2.656992883057296882e-08
2 5.400000000000000000e+01 1.000000000000000000e+02 1.731588100665248974e-04 1.891486708526498503e-07
3 1.040000000000000000e+02 1.000000000000000000e+02 3.327573901151481789e-04 1.855951227204178612e-07
4 1.540000000000000000e+02 1.000000000000000000e+02 4.930128000341937617e-04 2.744376670026742635e-07
5 2.040000000000000000e+02 1.000000000000000000e+02 6.546214299487473735e-04 5.883677983588543225e-07
6 2.540000000000000000e+02 1.000000000000000000e+02 8.212220899258682169e-04 1.126278112692182968e-06
7 3.040000000000000000e+02 1.000000000000000000e+02 1.015626240023266395e-03 3.254998559417442113e-06
8 3.540000000000000000e+02 1.000000000000000000e+02 1.220751460041356092e-03 5.651673945840259503e-06
9 4.040000000000000000e+02 1.000000000000000000e+02 1.469789179991494140e-03 1.230198810360312458e-05
10 4.540000000000000000e+02 1.000000000000000000e+02 1.757790079973346915e-03 1.897676531720800632e-05
11 5.040000000000000000e+02 1.000000000000000000e+02 2.089055169981293182e-03 2.956743840878384134e-05
12 5.540000000000000000e+02 1.000000000000000000e+02 2.498453950011025881e-03 3.814927536558484350e-05
13 6.040000000000000000e+02 1.000000000000000000e+02 3.009637379891500972e-03 5.073452290883979660e-05
14 6.540000000000000000e+02 1.000000000000000000e+02 3.482909410031425224e-03 6.954956500888895342e-05
15 7.040000000000000000e+02 1.000000000000000000e+02 4.206959059865766556e-03 7.551001508640306091e-05
16 7.540000000000000000e+02 1.000000000000000000e+02 4.908434529970691178e-03 7.480130306974699657e-05
17 8.040000000000000000e+02 1.000000000000000000e+02 5.724250219900568412e-03 9.401443578256306875e-05
18 8.540000000000000000e+02 1.000000000000000000e+02 6.402010290075850138e-03 9.696758969498020585e-05
19 9.040000000000000000e+02 1.000000000000000000e+02 7.130309890017088280e-03 1.214294101579835105e-04
20 9.540000000000000000e+02 1.000000000000000000e+02 8.238475820107851733e-03 1.317346528726986619e-04
21 1.004000000000000000e+03 1.000000000000000000e+02 9.108648289948178753e-03 1.116290141071140209e-04
22 1.054000000000000000e+03 1.000000000000000000e+02 1.004816869981368585e-02 1.294641140653965384e-04
23 1.104000000000000000e+03 1.000000000000000000e+02 1.081924826003160048e-02 1.313532735861817728e-04
24 1.154000000000000000e+03 1.000000000000000000e+02 1.177285703000961747e-02 1.599152765896968953e-04

View File

@ -0,0 +1,30 @@
import timeit
from collections import deque
import numpy as np
def measure_execution_time(circuit, state, repeat=100, **kwargs):
results = deque()
for _ in range(repeat):
s = state.deepcopy()
start = timeit.default_timer()
result = circuit * s
stop = timeit.default_timer()
results.append(stop - start)
return min(results)
def execution_statistics(circuits, state, scale=1, **kwargs):
results = deque()
for circuit in circuits:
results.append(measure_execution_time(circuit, state, **kwargs))
results = np.array(results, dtype=np.double)
results /= scale
N = len(results)
avg = np.average(results)
std_dev = np.std(results) / np.sqrt(N)
return N, avg, std_dev

View File

@ -6,12 +6,12 @@ import json
matplotlib.rcParams.update({'errorbar.capsize': 2})
results_graph0 = np.genfromtxt("circuit_scaling_graph_10qbit.csv")
with open("circuit_scaling_10qbit_meta.json") as fin:
results_graph0 = np.genfromtxt("circuit_scaling_graph1.csv")
with open("circuit_scaling_meta.json") as fin:
meta = json.load(fin)
h0 = plt.errorbar(results_graph0[:, 0], results_graph0[:, 2], results_graph0[:, 3]
, label=f"Graphical Simulator $N_q={meta['nqbits0']}$ Qbits"
, label=f"Graphical Simulator $N_q={meta['nqbits1']}$ Qbits"
, marker="^"
, color="black")
@ -20,5 +20,5 @@ plt.xlabel("Number of gates in circuit")
plt.ylabel("Execution time per circuit [s]")
plt.title(f"Execution Time for Random Circuits")
plt.savefig("scaling_circuits_10qbit_linear.png", dpi=400)
plt.savefig("scaling_circuits_50qbit_linear.png", dpi=400)
plt.show()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB