Skip to content

Commit db32f23

Browse files
committed
display error free success for more iterations
1 parent a26dc8c commit db32f23

File tree

4 files changed

+143
-13
lines changed

4 files changed

+143
-13
lines changed

notebooks/05_isotropic_grovers_complexity_4q.ipynb

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
{
1111
"cell_type": "code",
12-
"execution_count": null,
12+
"execution_count": 1,
1313
"metadata": {},
1414
"outputs": [],
1515
"source": [
@@ -236,6 +236,25 @@
236236
"cell_type": "code",
237237
"execution_count": 12,
238238
"metadata": {},
239+
"outputs": [
240+
{
241+
"name": "stdout",
242+
"output_type": "stream",
243+
"text": [
244+
"Search success probability = 96.131897 %\n"
245+
]
246+
}
247+
],
248+
"source": [
249+
"print(\n",
250+
" f\"Search success probability = {(statevector.probabilities_dict()['0011']) * 100: 4f} %\"\n",
251+
")"
252+
]
253+
},
254+
{
255+
"cell_type": "code",
256+
"execution_count": 13,
257+
"metadata": {},
239258
"outputs": [],
240259
"source": [
241260
"statevector_error = Statevector(\n",
@@ -245,7 +264,7 @@
245264
},
246265
{
247266
"cell_type": "code",
248-
"execution_count": 13,
267+
"execution_count": 14,
249268
"metadata": {},
250269
"outputs": [
251270
{
@@ -280,7 +299,7 @@
280299
},
281300
{
282301
"cell_type": "code",
283-
"execution_count": 14,
302+
"execution_count": 15,
284303
"metadata": {},
285304
"outputs": [],
286305
"source": [
@@ -293,7 +312,7 @@
293312
},
294313
{
295314
"cell_type": "code",
296-
"execution_count": 15,
315+
"execution_count": 16,
297316
"metadata": {},
298317
"outputs": [],
299318
"source": [
@@ -302,7 +321,7 @@
302321
},
303322
{
304323
"cell_type": "code",
305-
"execution_count": 16,
324+
"execution_count": null,
306325
"metadata": {},
307326
"outputs": [],
308327
"source": [
@@ -313,7 +332,7 @@
313332
},
314333
{
315334
"cell_type": "code",
316-
"execution_count": 17,
335+
"execution_count": null,
317336
"metadata": {},
318337
"outputs": [
319338
{

notebooks/06_isotropic_grovers_complexity_5q.ipynb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,25 @@
232232
"statevector = Statevector(grover_circuit)"
233233
]
234234
},
235+
{
236+
"cell_type": "code",
237+
"execution_count": 12,
238+
"metadata": {},
239+
"outputs": [
240+
{
241+
"name": "stdout",
242+
"output_type": "stream",
243+
"text": [
244+
"Search success probability = 99.918232 %\n"
245+
]
246+
}
247+
],
248+
"source": [
249+
"print(\n",
250+
" f\"Search success probability = {(statevector.probabilities_dict()['00011']) * 100: 4f} %\"\n",
251+
")"
252+
]
253+
},
235254
{
236255
"cell_type": "code",
237256
"execution_count": 12,

notebooks/07_isotropic_grovers_complexity_6q.ipynb

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,25 @@
232232
"statevector = Statevector(grover_circuit)"
233233
]
234234
},
235+
{
236+
"cell_type": "code",
237+
"execution_count": 12,
238+
"metadata": {},
239+
"outputs": [
240+
{
241+
"name": "stdout",
242+
"output_type": "stream",
243+
"text": [
244+
"Search success probability = 96.351548 %\n"
245+
]
246+
}
247+
],
248+
"source": [
249+
"print(\n",
250+
" f\"Search success probability = {(statevector.probabilities_dict()['000011']) * 100: 4f} %\"\n",
251+
")"
252+
]
253+
},
235254
{
236255
"cell_type": "code",
237256
"execution_count": 12,
@@ -271,7 +290,36 @@
271290
},
272291
{
273292
"cell_type": "code",
274-
"execution_count": 14,
293+
"execution_count": 13,
294+
"metadata": {},
295+
"outputs": [],
296+
"source": [
297+
"grover_circuit = get_grover_circuit(num_qubits=num_qubits, U_w=U_w, iterations=6)\n",
298+
"statevector = Statevector(grover_circuit)"
299+
]
300+
},
301+
{
302+
"cell_type": "code",
303+
"execution_count": 15,
304+
"metadata": {},
305+
"outputs": [
306+
{
307+
"name": "stdout",
308+
"output_type": "stream",
309+
"text": [
310+
"Search success probability = 99.658568 %\n"
311+
]
312+
}
313+
],
314+
"source": [
315+
"print(\n",
316+
" f\"Search success probability = {(statevector.probabilities_dict()['000011']) * 100: 4f} %\"\n",
317+
")"
318+
]
319+
},
320+
{
321+
"cell_type": "code",
322+
"execution_count": null,
275323
"metadata": {},
276324
"outputs": [
277325
{
@@ -283,8 +331,6 @@
283331
}
284332
],
285333
"source": [
286-
"grover_circuit = get_grover_circuit(num_qubits=num_qubits, U_w=U_w, iterations=6)\n",
287-
"statevector = Statevector(grover_circuit)\n",
288334
"statevector_error = Statevector(\n",
289335
" generate_and_add_isotropic_error(statevector.data, sigma=0.9).tolist()\n",
290336
")\n",

notebooks/08_isotropic_grovers_complexity_7q.ipynb

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,25 @@
236236
"cell_type": "code",
237237
"execution_count": 12,
238238
"metadata": {},
239+
"outputs": [
240+
{
241+
"name": "stdout",
242+
"output_type": "stream",
243+
"text": [
244+
"Search success probability = 94.199261 %\n"
245+
]
246+
}
247+
],
248+
"source": [
249+
"print(\n",
250+
" f\"Search success probability = {(statevector.probabilities_dict()['0000011']) * 100: 4f} %\"\n",
251+
")"
252+
]
253+
},
254+
{
255+
"cell_type": "code",
256+
"execution_count": 13,
257+
"metadata": {},
239258
"outputs": [],
240259
"source": [
241260
"statevector_error = Statevector(\n",
@@ -245,7 +264,7 @@
245264
},
246265
{
247266
"cell_type": "code",
248-
"execution_count": 13,
267+
"execution_count": 14,
249268
"metadata": {},
250269
"outputs": [
251270
{
@@ -271,7 +290,36 @@
271290
},
272291
{
273292
"cell_type": "code",
274-
"execution_count": 14,
293+
"execution_count": 15,
294+
"metadata": {},
295+
"outputs": [],
296+
"source": [
297+
"grover_circuit = get_grover_circuit(num_qubits=num_qubits, U_w=U_w, iterations=8)\n",
298+
"statevector = Statevector(grover_circuit)"
299+
]
300+
},
301+
{
302+
"cell_type": "code",
303+
"execution_count": 16,
304+
"metadata": {},
305+
"outputs": [
306+
{
307+
"name": "stdout",
308+
"output_type": "stream",
309+
"text": [
310+
"Search success probability = 99.561987 %\n"
311+
]
312+
}
313+
],
314+
"source": [
315+
"print(\n",
316+
" f\"Search success probability = {(statevector.probabilities_dict()['0000011']) * 100: 4f} %\"\n",
317+
")"
318+
]
319+
},
320+
{
321+
"cell_type": "code",
322+
"execution_count": null,
275323
"metadata": {},
276324
"outputs": [
277325
{
@@ -283,8 +331,6 @@
283331
}
284332
],
285333
"source": [
286-
"grover_circuit = get_grover_circuit(num_qubits=num_qubits, U_w=U_w, iterations=8)\n",
287-
"statevector = Statevector(grover_circuit)\n",
288334
"statevector_error = Statevector(\n",
289335
" generate_and_add_isotropic_error(statevector.data, sigma=0.9).tolist()\n",
290336
")\n",

0 commit comments

Comments
 (0)