bachelor_thesis/performance/plot_scaling_qbits_linear.py

33 lines
1.2 KiB
Python

import matplotlib.pyplot as plt
import matplotlib
import numpy as np
import json
matplotlib.rc('font', **{'family': 'serif', 'serif': ['Computer Modern']})
matplotlib.rc('text', usetex=True)
matplotlib.rcParams.update({'errorbar.capsize': 2})
results_naive = np.genfromtxt("qbit_scaling_naive.csv")
results_graph = np.genfromtxt("qbit_scaling_graph.csv")
with open("qbit_scaling_meta.json") as fin:
meta = json.load(fin)
h0 = plt.errorbar(results_naive[:, 0], results_naive[:, 2]*1000, results_naive[:, 3]*1000
, label=f"Dense Vector Simulator $N_c={int(results_naive[:, 1][0])}$ Circuits"
, marker="o"
, color="black")
h1 = plt.errorbar(results_graph[:, 0], results_graph[:, 2]*1000, results_graph[:, 3]*1000
, label=f"Graphical Simulator $N_c={int(results_graph[:, 1][0])}$ Circuits"
, marker="^"
, color="black")
plt.legend(handles=[h0, h1])
plt.xlabel("Number of Qbits $N_q$")
plt.ylabel("Execution Time per Circuit [ms]")
plt.title(f"Execution Time for ${meta['ngates_per_qbit']}\\times N_q$ Gates with Random Circuits (Rescaled)")
plt.savefig("scaling_qbits_linear.png", dpi=400)
plt.show()