Skip to content

Commit edc91c9

Browse files
committed
reworked comments for the constructor
1 parent 3b9f015 commit edc91c9

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

zero_noise_extrapolation_cnot.py

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -59,46 +59,45 @@ def __init__(self, qc: QuantumCircuit, exp_val_func: Callable, backend=None, exp
5959
backend :
6060
A qiskit backend, either an IBMQ quantum backend or a simulator backend, for circuit executions.
6161
62-
exp_val_options : dict, optional
62+
exp_val_options : dict, (optional)
6363
Options for the exp_val_func expectation value function
6464
65-
noise_model : qiskit.providers.aer.noise.NoiseModel, optional
65+
noise_model : qiskit.providers.aer.noise.NoiseModel, (optional)
6666
Custom noise model for circuit executions with the qasm simulator backend.
6767
68-
n_amp_factors : int
68+
n_amp_factors : int, (default set to 3)
6969
The number of noise amplification factors to be used. For n number of amplification factors, the specific
7070
noise amplification factors will be [1, 3, 5, ..., 2*n - 1]. Larger amounts of noise amplification factors
7171
tend to give better results, but slower convergence thus requiring large amounts of shots.
7272
Higher noise amplification also increases circuit depth, scaling linearly with the amplification factor c_i,
7373
and at some point the circuit depth and the consecutive decoherence will eliminate any further advantage.
7474
75-
shots: int
75+
shots: int, (default set to 8192)
76+
The number of "shots" of each experiment to be executed, where one experiment is a single execution of a
77+
quantum circuit. To obtain an error mitigated expectation value, a total of shots*n_amp_factors experiments
78+
is performed.
7679
80+
pauli_twirl : bool, (optional)
81+
Perform Pauli twirling of each noise amplified circuit, True / False.
7782
78-
pauli_twirl : bool
83+
pass_manager: qiskit.transpiler.PassManager, (optional)
84+
Optional custom pass_manager for circuit transpiling. If none is passed, the circuit will be transpiled
85+
using the qiskit optimization_level=3 preset, which is the heaviest optimization preset.
7986
80-
pass_manager: qiskit.transpiler.PassManager, optional
87+
save_results: bool, (optional)
88+
If True, will attempt to read transpiled circuit and experiment results for each noise amplified from disk,
89+
and if this fails, the transpiled circuit and/or experiment measurement results will be saved to disk.
8190
82-
save_results: bool, optional
91+
experiment_name: string, (optional)
92+
The experiment name used when reading and writing transpiled circuits and measurement results to disk.
93+
The experiment name will form the base for the full filename for each written/read file.
94+
This argument is required if save_result = True.
8395
84-
experiment_name: string, optional
96+
option: dict, (optional)
97+
Options for the writing/reading of transpiled circuits and measurement results.
98+
option["directory"] gives the directory in which files will be written to/attempted to be read from.
99+
If no option is passed, the default directory used will be option["directory"] = "results".
85100
86-
option: dict, optional
87-
88-
"""
89-
""" CONSTRUCTOR
90-
:param qc: The quantum circuit to be mitigated
91-
:param exp_val_func: A function that computes the observed expectation value of some operator measured by the
92-
quantum circuit. Should take a qiskit ExperimentResult object as it's sole argument
93-
:param backend: The backend on which to execute the circuit
94-
:param noise_model: Optinal custom noise model for execution on a simulator backend
95-
:param n_amp_factors: Max number of amplification factors to be used. For n amplification factors, the specific
96-
amplification factors will be 1,3,5,...,2n - 1
97-
:param pauli_twirl: Do pauli twirling True / False
98-
:param shots: The number of shots for which each noise amplified circuit will be executed in order to
99-
estimate the expectation value of said circuit
100-
:param pass_manager: Optional custom pass manager to use when transpiling the circuit
101-
:param save_results: Save partial results to file, True / False
102101
"""
103102

104103
# Set backend for circuit execution
@@ -144,7 +143,7 @@ def __init__(self, qc: QuantumCircuit, exp_val_func: Callable, backend=None, exp
144143

145144
self.counts = []
146145

147-
self.depths = empty(n_amp_factors)
146+
self.depths, self.gamma_factors = empty(n_amp_factors), empty(n_amp_factors)
148147

149148
self.exp_vals = zeros(0)
150149
self.all_exp_vals = zeros(0)

0 commit comments

Comments
 (0)