Skip to content

CNOT zero noise extrapolation #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dmypy.json

# Pyre type checker
.pyre/


.idea/
741 changes: 741 additions & 0 deletions 3qubit Swap-test.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion 5qubit GHZ state.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.8.3"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
84
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
394
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
84.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
394.0
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
100
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
461
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
90.49951171875
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
418.64501953125
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
88
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
410
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
84.43408203125
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
395.65673828125
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
107
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
487
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
97.3681640625
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
444.54833984375
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
91
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
429
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
85.3076171875
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
398.951171875
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
122
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
547
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
111.03125
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
495.94775390625
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
95
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
441
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
87.0048828125
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
405.3291015625
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
14 changes: 9 additions & 5 deletions zero_noise_extrapolation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import re #because we need regular expressions
import numpy as np #because we need the random number generator
from numpy.linalg import solve
from qiskit import *

from qiskit.transpiler import PassManager, PassManagerConfig, CouplingMap
from qiskit.transpiler.passes import Unroller, Optimize1qGates
from qiskit.transpiler.preset_passmanagers.level3 import level_3_pass_manager

from qiskit.tools.monitor import job_monitor

import sys
Expand Down Expand Up @@ -201,7 +207,7 @@ def Richardson_extrapolate(E, c):
for k in range(1,n):
A[k,:] = c**k
x=np.linalg.solve(A,b)
return np.dot(np.transpose(E),x)
return np.dot(np.transpose(E),x), x

def mitigate(circuit, amplification_factors,\
expectationvalue_fun,\
Expand Down Expand Up @@ -354,13 +360,11 @@ def mitigate(circuit, amplification_factors,\
else:
raise ValueError("not yet implemented, coming soon")

R=Richardson_extrapolate(E_av.reshape(len(amplification_factors),num_experiments),\
R,_=Richardson_extrapolate(E_av.reshape(len(amplification_factors),num_experiments),\
np.array(amplification_factors))


return R, E_dict, E_av_dict,\
max_depth_dict,mean_depth_dict,\
max_depth_transpiled_dict,mean_depth_transpiled_dict,\
experimentname


experimentname
Loading