pinitial_a=probability_a if pstep==1: pinitial_a=initial_a qcam.propinit(N,c,pinitial_a) t0=time.time() qproc() master_a=c.run() t1=time.time() print(' ') num,vector0_a,prob_a=qcam.qvextract(N,R,1,master_a) num,vector1_a,prob_a=qcam.qvextract(N,R,2,master_a) stdev,probability_a=qcam.qcalcd(N, num,vector0_a,prob_a) flowrate,flowcell_a=qcam.calcflow(N,num,vector0_a,vector1_a,prob_a) qcam.jamout(N,pstep,num,pinitial_a,vector0_a,prob_a,stdev,probability_a,flowrate,flowcell_a) cet = time.time() print(' Quantum Process Time =>',t1-t0) print(' Total Process Time =>',cet-cst) stepdist_a[pstep,0:N]=probability_a[0:N] fr_a[pstep]=flowrate stdev_a[pstep]=stdev ret=input(' NEXT(Y/N)?') qcam.jamfinal(N, pstep, initial_a ,stepdist_a, stdev_a, fr_a)
from blueqat import Circuit import numpy as np import qcam # -------- Setting ------------------------------------------------------------------ N = 8 # number of cells :You can change. R = 1 # number of registries initial_a = np.array( [0.9, 0, 0, 1, 0, 0.6, 0, 0], dtype='float') # initial probability distribution :You can change. vector_a = np.array([[0] * N] * (2 ^ N), dtype='int') csum_a = np.array([[0] * N] * (2 ^ N), dtype='float') final_a = np.array([0] * N, dtype='float') #---------- Main Body ---------------------------------------------------------------- ret = 'y' while ret == 'y': c = Circuit(N) qcam.propinit(N, c, initial_a) master_a = np.array(c.run()) num, vector_a, prob_a = qcam.qvextract(N, R, 1, master_a) stdev, final_a = qcam.qcalcd(N, num, vector_a, prob_a) qcam.qcresultout(N, 0, num, initial_a, vector_a, prob_a, stdev, final_a) ret = input(' NEXT(Y/N)?')