renamed a file
This commit is contained in:
parent
89f6f5bec2
commit
1701b480f0
|
@ -1,68 +0,0 @@
|
|||
from collections import deque
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import json
|
||||
|
||||
from pyqcs import State, H, X, S, CZ
|
||||
from pyqcs.graph.state import GraphState
|
||||
from pyqcs.util.random_circuits import random_circuit
|
||||
|
||||
from measure_circuit import execution_statistics
|
||||
|
||||
def S_with_extra_arg(act, i):
|
||||
return S(act)
|
||||
|
||||
def test_scaling_circuits(state_factory
|
||||
, nstart
|
||||
, nstop
|
||||
, step
|
||||
, nqbits
|
||||
, ncircuits
|
||||
, **kwargs):
|
||||
results = deque()
|
||||
|
||||
for ngates in range(nstart, nstop, step):
|
||||
circuits = [random_circuit(nqbits, ngates, X, H, S_with_extra_arg, CZ)
|
||||
for _ in range(ncircuits)]
|
||||
state = state_factory(nqbits)
|
||||
|
||||
print("running test with", ngates, "gates on", nqbits, "qbits")
|
||||
|
||||
N, avg, std_dev = execution_statistics(circuits, state, scale=1, **kwargs)
|
||||
results.append([ngates, N, avg, std_dev])
|
||||
|
||||
return np.array(results, dtype=np.double)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
nstart = 4
|
||||
nstop = 1200
|
||||
step = 50
|
||||
ncircuits = 100
|
||||
nqbits0 = 35
|
||||
seed = 0xdeadbeef
|
||||
|
||||
np.random.seed(seed)
|
||||
results_graph0 = test_scaling_circuits(GraphState.new_zero_state
|
||||
, nstart
|
||||
, nstop
|
||||
, step
|
||||
, nqbits0
|
||||
, ncircuits
|
||||
, repeat=10)
|
||||
|
||||
np.savetxt("circuit_scaling_graph_10qbit.csv", results_graph0)
|
||||
print("saved results to circuit_scaling_graph_10qbit.csv")
|
||||
|
||||
meta = {
|
||||
"nstart": nstart
|
||||
, "nstop": nstop
|
||||
, "step": step
|
||||
, "ncircuits": ncircuits
|
||||
, "nqbits0": nqbits0
|
||||
, "seed": seed}
|
||||
|
||||
with open("circuit_scaling_10qbit_meta.json", "w") as fout:
|
||||
json.dump(meta, fout)
|
||||
print("saved meta to circuit_scaling_10bit_meta.json")
|
||||
|
Loading…
Reference in New Issue
Block a user