diff --git a/performance/qbit_scaling_graph.csv b/performance/qbit_scaling_graph.csv new file mode 100644 index 0000000..cc17c29 --- /dev/null +++ b/performance/qbit_scaling_graph.csv @@ -0,0 +1,12 @@ +4.000000000000000000e+00 5.000000000000000000e+01 3.239394599904698983e-04 5.238557291679325816e-06 +5.000000000000000000e+00 5.000000000000000000e+01 3.282311160091921161e-04 5.206791716134118221e-06 +6.000000000000000000e+00 5.000000000000000000e+01 3.393389966580192532e-04 7.210579399522504517e-06 +7.000000000000000000e+00 5.000000000000000000e+01 3.485334800006967878e-04 6.133372307934436616e-06 +8.000000000000000000e+00 5.000000000000000000e+01 3.606396824989133425e-04 7.872948262396234801e-06 +9.000000000000000000e+00 5.000000000000000000e+01 3.684986977734499495e-04 6.945260956401134954e-06 +1.000000000000000000e+01 5.000000000000000000e+01 3.876681999954599469e-04 6.780600382400402471e-06 +1.100000000000000000e+01 5.000000000000000000e+01 4.052125854526489887e-04 7.937589161632314325e-06 +1.200000000000000000e+01 5.000000000000000000e+01 4.274679049998060575e-04 1.012095146525379624e-05 +1.300000000000000000e+01 5.000000000000000000e+01 4.431371061540490073e-04 1.193954587296790810e-05 +1.400000000000000000e+01 5.000000000000000000e+01 4.661075871438567016e-04 1.171191285039605426e-05 +1.500000000000000000e+01 5.000000000000000000e+01 4.989643959985793752e-04 1.541941106542285995e-05 diff --git a/performance/qbit_scaling_meta.json b/performance/qbit_scaling_meta.json new file mode 100644 index 0000000..5d3ba71 --- /dev/null +++ b/performance/qbit_scaling_meta.json @@ -0,0 +1 @@ +{"nstart": 4, "nstop": 16, "ncircuits": 50, "ngates_per_qbit": 100, "seed": 3735928559} \ No newline at end of file diff --git a/performance/qbit_scaling_naive.csv b/performance/qbit_scaling_naive.csv new file mode 100644 index 0000000..4ae36ee --- /dev/null +++ b/performance/qbit_scaling_naive.csv @@ -0,0 +1,12 @@ +4.000000000000000000e+00 5.000000000000000000e+01 5.476679499906822023e-04 2.408885102862740207e-06 +5.000000000000000000e+00 5.000000000000000000e+01 5.551456240027619494e-04 4.829193903192626175e-06 +6.000000000000000000e+00 5.000000000000000000e+01 5.855118333268667522e-04 1.850453831086512968e-05 +7.000000000000000000e+00 5.000000000000000000e+01 6.183522342897569387e-04 1.198932106957222646e-05 +8.000000000000000000e+00 5.000000000000000000e+01 6.563530025005092760e-04 6.555116391624968002e-06 +9.000000000000000000e+00 5.000000000000000000e+01 7.391909044488581765e-04 8.225023282170640282e-06 +1.000000000000000000e+01 5.000000000000000000e+01 8.980536999988544562e-04 1.079801438260659552e-05 +1.100000000000000000e+01 5.000000000000000000e+01 1.205755047270610147e-03 2.247180665566137078e-05 +1.200000000000000000e+01 5.000000000000000000e+01 1.953854708333438005e-03 5.515228539491306829e-05 +1.300000000000000000e+01 5.000000000000000000e+01 3.260316901537757724e-03 1.177441029627800557e-04 +1.400000000000000000e+01 5.000000000000000000e+01 5.731553058571339961e-03 1.832097576223597733e-04 +1.500000000000000000e+01 5.000000000000000000e+01 1.087934297466684741e-02 2.949436338465742788e-04 diff --git a/performance/regimes/circuit_scaling_10qbit_meta.json b/performance/regimes/circuit_scaling_10qbit_meta.json new file mode 100644 index 0000000..ad74a42 --- /dev/null +++ b/performance/regimes/circuit_scaling_10qbit_meta.json @@ -0,0 +1 @@ +{"nstart": 4, "nstop": 1200, "step": 50, "ncircuits": 100, "nqbits0": 35, "seed": 3735928559} \ No newline at end of file diff --git a/performance/regimes/circuit_scaling_graph0.csv b/performance/regimes/circuit_scaling_graph0.csv new file mode 100644 index 0000000..a860a7d --- /dev/null +++ b/performance/regimes/circuit_scaling_graph0.csv @@ -0,0 +1,48 @@ +4.000000000000000000e+02 1.000000000000000000e+02 1.292528080030024311e-03 5.733202073394208302e-07 +4.500000000000000000e+02 1.000000000000000000e+02 1.476095590023760503e-03 9.150408420618684019e-07 +5.000000000000000000e+02 1.000000000000000000e+02 1.636735730062355244e-03 9.540711274194226357e-07 +5.500000000000000000e+02 1.000000000000000000e+02 1.812536450020161335e-03 1.205841932777725135e-06 +6.000000000000000000e+02 1.000000000000000000e+02 1.971303310037910914e-03 1.414550401571716266e-06 +6.500000000000000000e+02 1.000000000000000000e+02 2.157640070013257944e-03 3.569517080329898580e-06 +7.000000000000000000e+02 1.000000000000000000e+02 2.336278169982506162e-03 5.980153904582388949e-06 +7.500000000000000000e+02 1.000000000000000000e+02 2.532670610025889064e-03 5.849055647582172711e-06 +8.000000000000000000e+02 1.000000000000000000e+02 2.754502079988014728e-03 1.066963759179946694e-05 +8.500000000000000000e+02 1.000000000000000000e+02 2.979709850010294880e-03 1.785366947202229990e-05 +9.000000000000000000e+02 1.000000000000000000e+02 3.185773269997298641e-03 2.117697256738389563e-05 +9.500000000000000000e+02 1.000000000000000000e+02 3.502167479996387729e-03 3.322615193221120021e-05 +1.000000000000000000e+03 1.000000000000000000e+02 3.887793099993359577e-03 5.842375420664064204e-05 +1.050000000000000000e+03 1.000000000000000000e+02 4.455797970003914053e-03 9.479105678860545562e-05 +1.100000000000000000e+03 1.000000000000000000e+02 5.159400599995933763e-03 1.513410784039731060e-04 +1.150000000000000000e+03 1.000000000000000000e+02 5.799823660013316527e-03 1.953180291633748020e-04 +1.200000000000000000e+03 1.000000000000000000e+02 7.020630370006984179e-03 2.710865763361874599e-04 +1.250000000000000000e+03 1.000000000000000000e+02 8.124420090020977037e-03 2.682436115424335953e-04 +1.300000000000000000e+03 1.000000000000000000e+02 1.031703455000751966e-02 4.460012337498552070e-04 +1.350000000000000000e+03 1.000000000000000000e+02 1.372481314997912698e-02 6.817167959261133912e-04 +1.400000000000000000e+03 1.000000000000000000e+02 1.614032759998735786e-02 7.655134146049649441e-04 +1.450000000000000000e+03 1.000000000000000000e+02 1.963383306001105499e-02 9.653066555976935140e-04 +1.500000000000000000e+03 1.000000000000000000e+02 2.355605447000016367e-02 1.007280367082364660e-03 +1.550000000000000000e+03 1.000000000000000000e+02 2.888593782998213899e-02 1.130616777752615869e-03 +1.600000000000000000e+03 1.000000000000000000e+02 3.090407874000902777e-02 1.196974704672377912e-03 +1.650000000000000000e+03 1.000000000000000000e+02 4.296136711001963954e-02 1.702392647792500251e-03 +1.700000000000000000e+03 1.000000000000000000e+02 4.937921152999024538e-02 1.758433174294420044e-03 +1.750000000000000000e+03 1.000000000000000000e+02 5.796087034999800047e-02 2.244819224471562326e-03 +1.800000000000000000e+03 1.000000000000000000e+02 6.485743561003801116e-02 2.157648692163186867e-03 +1.850000000000000000e+03 1.000000000000000000e+02 7.996037262000754708e-02 2.549463165917180245e-03 +1.900000000000000000e+03 1.000000000000000000e+02 8.725268216998756377e-02 2.497729997935764588e-03 +1.950000000000000000e+03 1.000000000000000000e+02 1.047749073099976114e-01 3.039336827493059438e-03 +2.000000000000000000e+03 1.000000000000000000e+02 1.135617462299751412e-01 3.120489282007932359e-03 +2.050000000000000000e+03 1.000000000000000000e+02 1.294428618100118833e-01 4.043919095824219205e-03 +2.100000000000000000e+03 1.000000000000000000e+02 1.493889781299958530e-01 4.360579876782301120e-03 +2.150000000000000000e+03 1.000000000000000000e+02 1.604279495600167138e-01 4.000128248651088798e-03 +2.200000000000000000e+03 1.000000000000000000e+02 1.849853525699563794e-01 4.630087951335896089e-03 +2.250000000000000000e+03 1.000000000000000000e+02 2.037768253299873378e-01 4.645343978297457495e-03 +2.300000000000000000e+03 1.000000000000000000e+02 2.297617539699740585e-01 5.582634363749477101e-03 +2.350000000000000000e+03 1.000000000000000000e+02 2.437538262999623950e-01 4.971193420050567732e-03 +2.400000000000000000e+03 1.000000000000000000e+02 2.698941993499829328e-01 5.216616307042788205e-03 +2.450000000000000000e+03 1.000000000000000000e+02 2.773576283999955039e-01 5.608918630422963895e-03 +2.500000000000000000e+03 1.000000000000000000e+02 3.092535914800009778e-01 5.558970822336704691e-03 +2.550000000000000000e+03 1.000000000000000000e+02 3.230660961900412298e-01 6.283839171520887168e-03 +2.600000000000000000e+03 1.000000000000000000e+02 3.471448883399989582e-01 6.080763225259631574e-03 +2.650000000000000000e+03 1.000000000000000000e+02 3.736992086399822943e-01 5.721224507783587328e-03 +2.700000000000000000e+03 1.000000000000000000e+02 3.990102667600330943e-01 6.176830635263770748e-03 +2.750000000000000000e+03 1.000000000000000000e+02 4.307573399299963191e-01 7.475051084608957778e-03 diff --git a/performance/regimes/circuit_scaling_graph1.csv b/performance/regimes/circuit_scaling_graph1.csv new file mode 100644 index 0000000..d629a3f --- /dev/null +++ b/performance/regimes/circuit_scaling_graph1.csv @@ -0,0 +1,48 @@ +4.000000000000000000e+02 1.000000000000000000e+02 1.339489360016159376e-03 4.373146691524687539e-06 +4.500000000000000000e+02 1.000000000000000000e+02 1.562109959986628278e-03 1.180899695630014391e-05 +5.000000000000000000e+02 1.000000000000000000e+02 1.778847130008216499e-03 1.149077062319606950e-05 +5.500000000000000000e+02 1.000000000000000000e+02 2.110902080021332880e-03 2.624849164697186263e-05 +6.000000000000000000e+02 1.000000000000000000e+02 2.507623680012329923e-03 5.024093633131331254e-05 +6.500000000000000000e+02 1.000000000000000000e+02 2.903985629982344056e-03 6.015885116030449901e-05 +7.000000000000000000e+02 1.000000000000000000e+02 3.571180630096932717e-03 8.668641931525905878e-05 +7.500000000000000000e+02 1.000000000000000000e+02 4.649395489932431173e-03 1.562207642547893283e-04 +8.000000000000000000e+02 1.000000000000000000e+02 5.546356450031453625e-03 1.582508901319584825e-04 +8.500000000000000000e+02 1.000000000000000000e+02 6.406500799985223767e-03 1.918995071719773620e-04 +9.000000000000000000e+02 1.000000000000000000e+02 8.359043909995306568e-03 2.340207500002419640e-04 +9.500000000000000000e+02 1.000000000000000000e+02 1.000986628994724077e-02 3.018884726136203791e-04 +1.000000000000000000e+03 1.000000000000000000e+02 1.170250708993080500e-02 3.032224032573330348e-04 +1.050000000000000000e+03 1.000000000000000000e+02 1.380836285999976175e-02 3.452895779108171629e-04 +1.100000000000000000e+03 1.000000000000000000e+02 1.621811796999281935e-02 3.723085100818067220e-04 +1.150000000000000000e+03 1.000000000000000000e+02 1.751635235991670994e-02 4.478445134046689607e-04 +1.200000000000000000e+03 1.000000000000000000e+02 2.175449063999622054e-02 4.550615158014478172e-04 +1.250000000000000000e+03 1.000000000000000000e+02 2.409289705004084847e-02 5.138623006510827183e-04 +1.300000000000000000e+03 1.000000000000000000e+02 2.707032501996764137e-02 5.352370173198506709e-04 +1.350000000000000000e+03 1.000000000000000000e+02 3.030421213003137507e-02 6.168532729649393864e-04 +1.400000000000000000e+03 1.000000000000000000e+02 3.292778922999786695e-02 6.216599880647764734e-04 +1.450000000000000000e+03 1.000000000000000000e+02 3.600494719007656108e-02 6.306597432476020214e-04 +1.500000000000000000e+03 1.000000000000000000e+02 4.062817144002110747e-02 5.695523913560983234e-04 +1.550000000000000000e+03 1.000000000000000000e+02 4.374126138997781049e-02 6.867946415651611427e-04 +1.600000000000000000e+03 1.000000000000000000e+02 4.496943137003654722e-02 7.410684775443047729e-04 +1.650000000000000000e+03 1.000000000000000000e+02 4.960669941999185789e-02 6.949628904898550634e-04 +1.700000000000000000e+03 1.000000000000000000e+02 5.404410303002805255e-02 6.394108496901118686e-04 +1.750000000000000000e+03 1.000000000000000000e+02 5.542541316996903167e-02 8.394048440130790194e-04 +1.800000000000000000e+03 1.000000000000000000e+02 6.030962357997850937e-02 7.403164840214486583e-04 +1.850000000000000000e+03 1.000000000000000000e+02 6.299317811999571859e-02 8.144342068100703189e-04 +1.900000000000000000e+03 1.000000000000000000e+02 6.699343264000162668e-02 7.670420236218962202e-04 +1.950000000000000000e+03 1.000000000000000000e+02 7.118386181999994400e-02 6.646562386100526290e-04 +2.000000000000000000e+03 1.000000000000000000e+02 7.348656025002128778e-02 8.370289188304915872e-04 +2.050000000000000000e+03 1.000000000000000000e+02 7.429763381001067146e-02 7.700828038098531548e-04 +2.100000000000000000e+03 1.000000000000000000e+02 7.828760585999589017e-02 7.691943397858324542e-04 +2.150000000000000000e+03 1.000000000000000000e+02 8.402856610011440186e-02 8.349493053548320007e-04 +2.200000000000000000e+03 1.000000000000000000e+02 8.729005758003040294e-02 7.691550593819323047e-04 +2.250000000000000000e+03 1.000000000000000000e+02 9.405598109005949836e-02 9.178635033626555842e-04 +2.300000000000000000e+03 1.000000000000000000e+02 9.799322385992127737e-02 9.222294375051240303e-04 +2.350000000000000000e+03 1.000000000000000000e+02 1.006686677600191621e-01 9.167243728391789642e-04 +2.400000000000000000e+03 1.000000000000000000e+02 1.047712729699196710e-01 8.665465747754112335e-04 +2.450000000000000000e+03 1.000000000000000000e+02 1.063802617899273217e-01 9.078377647675694648e-04 +2.500000000000000000e+03 1.000000000000000000e+02 1.100784591899355291e-01 8.827002059403676664e-04 +2.550000000000000000e+03 1.000000000000000000e+02 1.150724165801148002e-01 9.343339900374694057e-04 +2.600000000000000000e+03 1.000000000000000000e+02 1.193642491499849745e-01 9.657911774894351736e-04 +2.650000000000000000e+03 1.000000000000000000e+02 1.208200644799580920e-01 8.525406023378619266e-04 +2.700000000000000000e+03 1.000000000000000000e+02 1.262045125600161632e-01 8.985605875767001477e-04 +2.750000000000000000e+03 1.000000000000000000e+02 1.257651572799295403e-01 9.551881433090064159e-04 diff --git a/performance/regimes/circuit_scaling_graph_10qbit.csv b/performance/regimes/circuit_scaling_graph_10qbit.csv new file mode 100644 index 0000000..a5f84c8 --- /dev/null +++ b/performance/regimes/circuit_scaling_graph_10qbit.csv @@ -0,0 +1,24 @@ +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 diff --git a/performance/regimes/circuit_scaling_meta.json b/performance/regimes/circuit_scaling_meta.json new file mode 100644 index 0000000..a7d402d --- /dev/null +++ b/performance/regimes/circuit_scaling_meta.json @@ -0,0 +1 @@ +{"nstart": 400, "nstop": 1800, "step": 50, "ncircuits": 50, "nqbits0": 100, "nqbits1": 50, "seed": 3735928559} \ No newline at end of file diff --git a/performance/generate_data_scaling_circuits.py b/performance/regimes/generate_data_scaling_circuits.py similarity index 91% rename from performance/generate_data_scaling_circuits.py rename to performance/regimes/generate_data_scaling_circuits.py index 0289d11..77afc65 100644 --- a/performance/generate_data_scaling_circuits.py +++ b/performance/regimes/generate_data_scaling_circuits.py @@ -66,13 +66,13 @@ if __name__ == "__main__": print("saved results1 to circuit_scaling_graph1.csv") meta = { - "nstart": 400 - , "nstop": 1800 - , "step": 50 - , "ncircuits": 50 - , "nqbits0": 100 - , "nqbits1": 50 - , "seed": 0xdeadbeef} + "nstart": nstart + , "nstop": nstop + , "step": step + , "ncircuits": ncircuits + , "nqbits0": nqbits0 + , "nqbits1": nqbits1 + , "seed": seed} with open("circuit_scaling_meta.json", "w") as fout: json.dump(meta, fout) diff --git a/performance/regimes/generate_data_scaling_circuits_10qbit.py b/performance/regimes/generate_data_scaling_circuits_10qbit.py new file mode 100644 index 0000000..8f77f5f --- /dev/null +++ b/performance/regimes/generate_data_scaling_circuits_10qbit.py @@ -0,0 +1,68 @@ +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") + diff --git a/performance/regimes/graph_high_linear_regime.dot b/performance/regimes/graph_high_linear_regime.dot new file mode 100644 index 0000000..7d81f3b --- /dev/null +++ b/performance/regimes/graph_high_linear_regime.dot @@ -0,0 +1,591 @@ +graph graphical_state{ +0 -- 3 +0 -- 4 +0 -- 5 +0 -- 7 +0 -- 9 +0 -- 10 +0 -- 12 +0 -- 15 +0 -- 16 +0 -- 18 +0 -- 19 +0 -- 20 +0 -- 22 +0 -- 25 +0 -- 26 +0 -- 27 +0 -- 28 +0 -- 32 +0 -- 33 +0 -- 35 +0 -- 38 +0 -- 39 +0 -- 40 +0 -- 41 +0 -- 42 +0 -- 45 +0 -- 47 +0 -- 48 +1 -- 3 +1 -- 4 +1 -- 5 +1 -- 8 +1 -- 9 +1 -- 11 +1 -- 12 +1 -- 13 +1 -- 14 +1 -- 16 +1 -- 17 +1 -- 18 +1 -- 19 +1 -- 20 +1 -- 24 +1 -- 27 +1 -- 28 +1 -- 30 +1 -- 31 +1 -- 32 +1 -- 33 +1 -- 34 +1 -- 35 +1 -- 37 +1 -- 39 +1 -- 43 +1 -- 44 +1 -- 46 +2 -- 7 +2 -- 9 +2 -- 10 +2 -- 11 +2 -- 12 +2 -- 16 +2 -- 18 +2 -- 19 +2 -- 20 +2 -- 21 +2 -- 23 +2 -- 25 +2 -- 27 +2 -- 31 +2 -- 36 +2 -- 39 +2 -- 40 +2 -- 41 +2 -- 44 +2 -- 45 +2 -- 48 +3 -- 4 +3 -- 5 +3 -- 6 +3 -- 7 +3 -- 10 +3 -- 11 +3 -- 12 +3 -- 13 +3 -- 14 +3 -- 15 +3 -- 16 +3 -- 17 +3 -- 19 +3 -- 20 +3 -- 25 +3 -- 26 +3 -- 27 +3 -- 29 +3 -- 31 +3 -- 32 +3 -- 34 +3 -- 35 +3 -- 36 +3 -- 37 +3 -- 38 +3 -- 40 +3 -- 42 +3 -- 43 +3 -- 46 +3 -- 47 +4 -- 7 +4 -- 9 +4 -- 11 +4 -- 12 +4 -- 16 +4 -- 19 +4 -- 20 +4 -- 21 +4 -- 23 +4 -- 24 +4 -- 25 +4 -- 29 +4 -- 30 +4 -- 31 +4 -- 32 +4 -- 35 +4 -- 39 +4 -- 40 +4 -- 41 +4 -- 42 +4 -- 44 +4 -- 46 +4 -- 48 +5 -- 8 +5 -- 12 +5 -- 13 +5 -- 15 +5 -- 19 +5 -- 22 +5 -- 23 +5 -- 24 +5 -- 27 +5 -- 29 +5 -- 30 +5 -- 34 +5 -- 35 +5 -- 40 +5 -- 41 +5 -- 42 +5 -- 47 +6 -- 7 +6 -- 8 +6 -- 9 +6 -- 10 +6 -- 16 +6 -- 18 +6 -- 19 +6 -- 21 +6 -- 23 +6 -- 25 +6 -- 26 +6 -- 28 +6 -- 30 +6 -- 31 +6 -- 32 +6 -- 35 +6 -- 38 +6 -- 41 +6 -- 42 +6 -- 43 +6 -- 45 +6 -- 46 +6 -- 47 +7 -- 11 +7 -- 13 +7 -- 14 +7 -- 15 +7 -- 17 +7 -- 19 +7 -- 21 +7 -- 23 +7 -- 25 +7 -- 29 +7 -- 33 +7 -- 34 +7 -- 35 +7 -- 39 +7 -- 40 +7 -- 42 +7 -- 43 +7 -- 48 +8 -- 9 +8 -- 13 +8 -- 14 +8 -- 16 +8 -- 17 +8 -- 18 +8 -- 21 +8 -- 22 +8 -- 24 +8 -- 26 +8 -- 28 +8 -- 29 +8 -- 31 +8 -- 32 +8 -- 34 +8 -- 35 +8 -- 39 +8 -- 41 +8 -- 42 +8 -- 43 +8 -- 45 +8 -- 48 +9 -- 11 +9 -- 16 +9 -- 18 +9 -- 19 +9 -- 20 +9 -- 21 +9 -- 23 +9 -- 24 +9 -- 27 +9 -- 29 +9 -- 30 +9 -- 31 +9 -- 32 +9 -- 33 +9 -- 34 +9 -- 35 +9 -- 38 +9 -- 40 +9 -- 42 +9 -- 45 +9 -- 48 +10 -- 13 +10 -- 16 +10 -- 17 +10 -- 18 +10 -- 21 +10 -- 23 +10 -- 27 +10 -- 28 +10 -- 29 +10 -- 30 +10 -- 33 +10 -- 35 +10 -- 37 +10 -- 38 +10 -- 39 +10 -- 42 +10 -- 45 +10 -- 46 +10 -- 48 +11 -- 17 +11 -- 18 +11 -- 19 +11 -- 21 +11 -- 25 +11 -- 32 +11 -- 33 +11 -- 34 +11 -- 35 +11 -- 37 +11 -- 38 +11 -- 42 +11 -- 45 +11 -- 46 +12 -- 14 +12 -- 15 +12 -- 16 +12 -- 17 +12 -- 22 +12 -- 23 +12 -- 24 +12 -- 25 +12 -- 26 +12 -- 28 +12 -- 29 +12 -- 32 +12 -- 33 +12 -- 34 +12 -- 35 +12 -- 36 +12 -- 37 +12 -- 40 +12 -- 41 +12 -- 42 +12 -- 44 +12 -- 46 +12 -- 47 +12 -- 48 +13 -- 17 +13 -- 18 +13 -- 21 +13 -- 23 +13 -- 24 +13 -- 28 +13 -- 29 +13 -- 30 +13 -- 32 +13 -- 33 +13 -- 36 +13 -- 38 +13 -- 39 +13 -- 42 +13 -- 45 +13 -- 47 +14 -- 17 +14 -- 20 +14 -- 23 +14 -- 24 +14 -- 25 +14 -- 29 +14 -- 30 +14 -- 31 +14 -- 32 +14 -- 35 +14 -- 36 +14 -- 37 +14 -- 39 +14 -- 43 +14 -- 44 +14 -- 45 +14 -- 47 +14 -- 48 +15 -- 17 +15 -- 19 +15 -- 22 +15 -- 23 +15 -- 24 +15 -- 25 +15 -- 27 +15 -- 29 +15 -- 33 +15 -- 34 +15 -- 39 +15 -- 41 +15 -- 43 +15 -- 44 +15 -- 45 +15 -- 48 +16 -- 18 +16 -- 19 +16 -- 20 +16 -- 21 +16 -- 22 +16 -- 23 +16 -- 26 +16 -- 28 +16 -- 30 +16 -- 31 +16 -- 35 +16 -- 36 +16 -- 38 +16 -- 39 +16 -- 41 +16 -- 44 +16 -- 47 +17 -- 18 +17 -- 19 +17 -- 21 +17 -- 24 +17 -- 25 +17 -- 26 +17 -- 28 +17 -- 34 +17 -- 35 +17 -- 38 +17 -- 39 +17 -- 40 +17 -- 43 +17 -- 45 +17 -- 46 +17 -- 48 +18 -- 19 +18 -- 20 +18 -- 22 +18 -- 23 +18 -- 25 +18 -- 30 +18 -- 31 +18 -- 33 +18 -- 35 +18 -- 41 +18 -- 45 +18 -- 47 +18 -- 48 +19 -- 20 +19 -- 21 +19 -- 22 +19 -- 23 +19 -- 24 +19 -- 25 +19 -- 26 +19 -- 28 +19 -- 31 +19 -- 32 +19 -- 34 +19 -- 35 +19 -- 37 +19 -- 38 +19 -- 40 +19 -- 41 +19 -- 45 +19 -- 46 +19 -- 47 +19 -- 48 +20 -- 24 +20 -- 25 +20 -- 26 +20 -- 27 +20 -- 32 +20 -- 33 +20 -- 37 +20 -- 39 +20 -- 45 +21 -- 22 +21 -- 24 +21 -- 25 +21 -- 27 +21 -- 29 +21 -- 30 +21 -- 33 +21 -- 34 +21 -- 36 +21 -- 38 +21 -- 39 +21 -- 44 +21 -- 45 +21 -- 46 +21 -- 47 +21 -- 48 +22 -- 23 +22 -- 25 +22 -- 27 +22 -- 30 +22 -- 32 +22 -- 33 +22 -- 34 +22 -- 35 +22 -- 36 +22 -- 39 +22 -- 42 +22 -- 43 +22 -- 44 +22 -- 45 +22 -- 46 +22 -- 47 +23 -- 25 +23 -- 26 +23 -- 32 +23 -- 37 +23 -- 38 +23 -- 39 +23 -- 40 +23 -- 41 +23 -- 43 +23 -- 45 +23 -- 46 +24 -- 25 +24 -- 26 +24 -- 28 +24 -- 29 +24 -- 31 +24 -- 33 +24 -- 35 +24 -- 36 +24 -- 38 +24 -- 39 +24 -- 43 +25 -- 29 +25 -- 33 +25 -- 34 +25 -- 35 +25 -- 38 +25 -- 39 +25 -- 41 +25 -- 43 +25 -- 44 +25 -- 46 +26 -- 27 +26 -- 30 +26 -- 34 +26 -- 37 +26 -- 39 +26 -- 43 +26 -- 44 +26 -- 45 +27 -- 28 +27 -- 29 +27 -- 32 +27 -- 34 +27 -- 47 +28 -- 30 +28 -- 31 +28 -- 34 +28 -- 37 +28 -- 38 +28 -- 40 +28 -- 41 +28 -- 43 +28 -- 48 +29 -- 30 +29 -- 32 +29 -- 35 +29 -- 38 +29 -- 41 +29 -- 43 +29 -- 48 +30 -- 32 +30 -- 33 +30 -- 34 +30 -- 39 +30 -- 44 +30 -- 45 +30 -- 46 +31 -- 32 +31 -- 33 +31 -- 34 +31 -- 36 +31 -- 39 +31 -- 40 +31 -- 41 +31 -- 43 +31 -- 44 +31 -- 46 +31 -- 47 +31 -- 48 +32 -- 33 +32 -- 34 +32 -- 36 +32 -- 37 +32 -- 39 +32 -- 43 +32 -- 44 +32 -- 45 +32 -- 46 +32 -- 47 +33 -- 34 +33 -- 38 +33 -- 42 +33 -- 43 +33 -- 45 +33 -- 47 +34 -- 35 +34 -- 38 +34 -- 39 +34 -- 48 +35 -- 36 +35 -- 37 +35 -- 39 +35 -- 40 +35 -- 45 +36 -- 37 +36 -- 38 +36 -- 39 +36 -- 40 +36 -- 42 +36 -- 43 +36 -- 44 +36 -- 45 +36 -- 46 +36 -- 47 +36 -- 48 +37 -- 38 +37 -- 39 +37 -- 41 +37 -- 45 +37 -- 46 +38 -- 39 +38 -- 42 +38 -- 44 +38 -- 46 +38 -- 48 +39 -- 40 +39 -- 41 +39 -- 42 +39 -- 44 +40 -- 43 +40 -- 44 +40 -- 47 +41 -- 43 +41 -- 45 +41 -- 46 +41 -- 47 +42 -- 48 +43 -- 45 +43 -- 46 +44 -- 45 +45 -- 46 +45 -- 48 +46 -- 48 +} diff --git a/performance/regimes/graph_high_linear_regime.png b/performance/regimes/graph_high_linear_regime.png new file mode 100644 index 0000000..691ecc3 Binary files /dev/null and b/performance/regimes/graph_high_linear_regime.png differ diff --git a/performance/regimes/graph_high_linear_regime.py b/performance/regimes/graph_high_linear_regime.py new file mode 100644 index 0000000..556b9d9 --- /dev/null +++ b/performance/regimes/graph_high_linear_regime.py @@ -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 +from pyqcs.graph.state import GraphState +from pyqcs.util.random_circuits import random_circuit + +def S_with_extra_arg(act, i): + return S(act) + +np.random.seed(0xdeadbeef) + +circuit = random_circuit(50, 1500, X, H, S_with_extra_arg, CZ) + +state = circuit * GraphState.new_plus_state(50) + +vops, edges = state._g_state.to_lists() + +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_edges_str + "\n}" + +print(dot_str) diff --git a/performance/regimes/graph_low_linear_regime.dot b/performance/regimes/graph_low_linear_regime.dot new file mode 100644 index 0000000..96b61cc --- /dev/null +++ b/performance/regimes/graph_low_linear_regime.dot @@ -0,0 +1,30 @@ +graph graphical_state{ +1 -- 11 +1 -- 30 +1 -- 33 +2 -- 26 +4 -- 6 +4 -- 29 +4 -- 43 +5 -- 39 +6 -- 29 +6 -- 45 +11 -- 19 +11 -- 33 +12 -- 14 +17 -- 28 +17 -- 30 +17 -- 38 +17 -- 44 +20 -- 38 +23 -- 32 +24 -- 26 +24 -- 38 +25 -- 28 +25 -- 30 +25 -- 44 +26 -- 38 +27 -- 33 +29 -- 33 +29 -- 43 +} diff --git a/performance/regimes/graph_low_linear_regime.png b/performance/regimes/graph_low_linear_regime.png new file mode 100644 index 0000000..bbcc226 Binary files /dev/null and b/performance/regimes/graph_low_linear_regime.png differ diff --git a/performance/regimes/graph_low_linear_regime.py b/performance/regimes/graph_low_linear_regime.py new file mode 100644 index 0000000..92f33a8 --- /dev/null +++ b/performance/regimes/graph_low_linear_regime.py @@ -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 +from pyqcs.graph.state import GraphState +from pyqcs.util.random_circuits import random_circuit + +def S_with_extra_arg(act, i): + return S(act) + +np.random.seed(0xdeadbeef) + +circuit = random_circuit(50, 120, X, H, S_with_extra_arg, CZ) + +state = circuit * GraphState.new_plus_state(50) + +vops, edges = state._g_state.to_lists() + +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_edges_str + "\n}" + +print(dot_str) diff --git a/performance/regimes/plot_scaling_circuits_10qbit_linear.py b/performance/regimes/plot_scaling_circuits_10qbit_linear.py new file mode 100644 index 0000000..8a733d3 --- /dev/null +++ b/performance/regimes/plot_scaling_circuits_10qbit_linear.py @@ -0,0 +1,24 @@ +from collections import deque +import matplotlib +import matplotlib.pyplot as plt +import numpy as np +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: + 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" + , marker="^" + , color="black") + +plt.legend(handles=[h0]) +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.show() diff --git a/performance/plot_scaling_circuits_linear.py b/performance/regimes/plot_scaling_circuits_linear.py similarity index 95% rename from performance/plot_scaling_circuits_linear.py rename to performance/regimes/plot_scaling_circuits_linear.py index dd5a88d..ea1c97d 100644 --- a/performance/plot_scaling_circuits_linear.py +++ b/performance/regimes/plot_scaling_circuits_linear.py @@ -23,7 +23,7 @@ h1 = plt.errorbar(results_graph1[:, 0], results_graph1[:, 2], results_graph1[:, plt.legend(handles=[h0, h1]) plt.xlabel("Number of gates in circuit") plt.ylabel("Execution time per circuit [s]") -plt.title(f"Execution Time for random Circuits") +plt.title(f"Execution Time for Random Circuits") plt.savefig("scaling_circuits_linear.png", dpi=400) plt.show() diff --git a/performance/regimes/scaling_circuits_10qbit_linear.png b/performance/regimes/scaling_circuits_10qbit_linear.png new file mode 100644 index 0000000..ac718cb Binary files /dev/null and b/performance/regimes/scaling_circuits_10qbit_linear.png differ diff --git a/performance/regimes/scaling_circuits_linear.png b/performance/regimes/scaling_circuits_linear.png new file mode 100644 index 0000000..b2759f8 Binary files /dev/null and b/performance/regimes/scaling_circuits_linear.png differ diff --git a/performance/scaling_qbits_linear.png b/performance/scaling_qbits_linear.png new file mode 100644 index 0000000..566a871 Binary files /dev/null and b/performance/scaling_qbits_linear.png differ diff --git a/performance/scaling_qbits_log.png b/performance/scaling_qbits_log.png new file mode 100644 index 0000000..efdcc05 Binary files /dev/null and b/performance/scaling_qbits_log.png differ