iqm-benchmarks 2.10__py3-none-any.whl → 2.12__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of iqm-benchmarks might be problematic. Click here for more details.
- iqm/benchmarks/compressive_gst/compressive_gst.py +5 -1
- iqm/benchmarks/entanglement/ghz.py +65 -51
- iqm/benchmarks/optimization/qscore.py +11 -4
- iqm/benchmarks/quantum_volume/clops.py +2 -2
- iqm/benchmarks/randomized_benchmarking/clifford_rb/clifford_rb.py +6 -0
- iqm/benchmarks/randomized_benchmarking/interleaved_rb/interleaved_rb.py +28 -7
- iqm/benchmarks/randomized_benchmarking/mirror_rb/mirror_rb.py +12 -5
- iqm/benchmarks/randomized_benchmarking/randomized_benchmarking_common.py +43 -11
- iqm/benchmarks/utils.py +20 -4
- {iqm_benchmarks-2.10.dist-info → iqm_benchmarks-2.12.dist-info}/METADATA +1 -1
- {iqm_benchmarks-2.10.dist-info → iqm_benchmarks-2.12.dist-info}/RECORD +14 -14
- {iqm_benchmarks-2.10.dist-info → iqm_benchmarks-2.12.dist-info}/LICENSE +0 -0
- {iqm_benchmarks-2.10.dist-info → iqm_benchmarks-2.12.dist-info}/WHEEL +0 -0
- {iqm_benchmarks-2.10.dist-info → iqm_benchmarks-2.12.dist-info}/top_level.txt +0 -0
|
@@ -137,7 +137,11 @@ class CompressiveGST(Benchmark):
|
|
|
137
137
|
raw_qc_list = qiskit_interface.get_qiskit_circuits(
|
|
138
138
|
gate_circuits, self.gate_set, self.num_qubits, unmapped_qubits
|
|
139
139
|
)
|
|
140
|
-
|
|
140
|
+
if "move" in self.backend.operation_names:
|
|
141
|
+
qcvv_logger.warning(
|
|
142
|
+
f"Transpilation on star-architectures currently allows move gates to transit barriers, "
|
|
143
|
+
f"leading to context-dependent gates which GST can not accurately resolve."
|
|
144
|
+
)
|
|
141
145
|
for qubits in self.qubit_layouts:
|
|
142
146
|
coupling_map = set_coupling_map(qubits, self.backend, physical_layout="fixed")
|
|
143
147
|
|
|
@@ -28,7 +28,7 @@ import networkx
|
|
|
28
28
|
from networkx import Graph, all_pairs_shortest_path, is_connected, minimum_spanning_tree
|
|
29
29
|
import numpy as np
|
|
30
30
|
import pycurl
|
|
31
|
-
from qiskit import QuantumRegister
|
|
31
|
+
from qiskit import QuantumRegister
|
|
32
32
|
from qiskit.quantum_info import random_clifford
|
|
33
33
|
from qiskit.transpiler import CouplingMap
|
|
34
34
|
from qiskit_aer import Aer
|
|
@@ -60,47 +60,6 @@ from iqm.qiskit_iqm import IQMCircuit as QuantumCircuit
|
|
|
60
60
|
from iqm.qiskit_iqm.iqm_backend import IQMBackendBase
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
@timeit
|
|
64
|
-
def append_rms(
|
|
65
|
-
circuit: QuantumCircuit,
|
|
66
|
-
num_rms: int,
|
|
67
|
-
backend: IQMBackendBase,
|
|
68
|
-
# optimize_sqg: bool = False,
|
|
69
|
-
) -> List[QuantumCircuit]:
|
|
70
|
-
"""
|
|
71
|
-
Appends 1Q Clifford gates sampled uniformly at random to all qubits in the given circuit.
|
|
72
|
-
Args:
|
|
73
|
-
circuit (QuantumCircuit):
|
|
74
|
-
num_rms (int):
|
|
75
|
-
backend (Optional[IQMBackendBase]): whether Cliffords are decomposed for the given backend
|
|
76
|
-
Returns:
|
|
77
|
-
List[QuantumCircuit] of the original circuit with 1Q Clifford gates appended to it
|
|
78
|
-
"""
|
|
79
|
-
rm_circuits: list[QuantumCircuit] = []
|
|
80
|
-
for _ in range(num_rms):
|
|
81
|
-
rm_circ = circuit.copy()
|
|
82
|
-
# It shouldn't matter if measurement bits get scrambled
|
|
83
|
-
rm_circ.remove_final_measurements()
|
|
84
|
-
|
|
85
|
-
active_qubits = set()
|
|
86
|
-
data = rm_circ.data
|
|
87
|
-
for instruction in data:
|
|
88
|
-
for qubit in instruction[1]:
|
|
89
|
-
active_qubits.add(rm_circ.find_bit(qubit)[0])
|
|
90
|
-
|
|
91
|
-
for q in active_qubits:
|
|
92
|
-
if backend is not None:
|
|
93
|
-
rand_clifford = random_clifford(1).to_circuit()
|
|
94
|
-
else:
|
|
95
|
-
rand_clifford = random_clifford(1).to_instruction()
|
|
96
|
-
rm_circ.compose(rand_clifford, qubits=[q], inplace=True)
|
|
97
|
-
|
|
98
|
-
rm_circ.measure_active()
|
|
99
|
-
rm_circuits.append(transpile(rm_circ, basis_gates=backend.operation_names))
|
|
100
|
-
|
|
101
|
-
return rm_circuits
|
|
102
|
-
|
|
103
|
-
|
|
104
63
|
def fidelity_ghz_randomized_measurements(
|
|
105
64
|
dataset: xr.Dataset, qubit_layout, ideal_probabilities: List[Dict[str, int]], num_qubits: int, circuits: Circuits
|
|
106
65
|
) -> tuple[dict[str, Any], dict[str, Any]]:
|
|
@@ -257,7 +216,7 @@ def fidelity_analysis(run: BenchmarkRunResult) -> BenchmarkAnalysisResult:
|
|
|
257
216
|
ideal_simulator = Aer.get_backend("statevector_simulator")
|
|
258
217
|
ideal_probabilities = []
|
|
259
218
|
idx = BenchmarkObservationIdentifier(qubit_layout).string_identifier
|
|
260
|
-
all_circuits = run.circuits["
|
|
219
|
+
all_circuits = run.circuits["untranspiled_circuits"][f"{idx}_rm_circuits"].circuits
|
|
261
220
|
for qc in all_circuits:
|
|
262
221
|
qc_copy = qc.copy()
|
|
263
222
|
qc_copy.remove_final_measurements()
|
|
@@ -474,9 +433,8 @@ def get_edges(
|
|
|
474
433
|
graph: networkx.Graph
|
|
475
434
|
The final weighted graph for the given calibration or coupling map
|
|
476
435
|
"""
|
|
477
|
-
edges_coupling = list(coupling_map.get_edges())[::2]
|
|
478
436
|
edges_patch = []
|
|
479
|
-
for idx, edge in enumerate(
|
|
437
|
+
for idx, edge in enumerate(coupling_map):
|
|
480
438
|
if edge[0] in qubit_layout and edge[1] in qubit_layout:
|
|
481
439
|
edges_patch.append([edge[0], edge[1]])
|
|
482
440
|
|
|
@@ -681,11 +639,16 @@ class GHZBenchmark(Benchmark):
|
|
|
681
639
|
)
|
|
682
640
|
final_ghz = ghz_native_transpiled
|
|
683
641
|
elif routine == "tree":
|
|
642
|
+
# For star architectures, create an effective coupling map that represents all-to-all connectivity
|
|
643
|
+
if "move" in self.backend.operation_names:
|
|
644
|
+
effective_coupling_map = [[x, y] for x in qubit_layout for y in qubit_layout if x != y]
|
|
645
|
+
else:
|
|
646
|
+
effective_coupling_map = self.backend.coupling_map
|
|
684
647
|
if self.cal_url:
|
|
685
648
|
edges_cal, fidelities_cal = extract_fidelities(self.cal_url, qubit_layout)
|
|
686
|
-
graph = get_edges(
|
|
649
|
+
graph = get_edges(effective_coupling_map, qubit_layout, edges_cal, fidelities_cal)
|
|
687
650
|
else:
|
|
688
|
-
graph = get_edges(
|
|
651
|
+
graph = get_edges(effective_coupling_map, qubit_layout)
|
|
689
652
|
ghz, _ = generate_ghz_spanning_tree(graph, qubit_layout, qubit_count)
|
|
690
653
|
circuit_group.add_circuit(ghz)
|
|
691
654
|
ghz_native_transpiled, _ = perform_backend_transpilation(
|
|
@@ -764,6 +727,60 @@ class GHZBenchmark(Benchmark):
|
|
|
764
727
|
self.circuits["untranspiled_circuits"].circuit_groups.append(circuit_group)
|
|
765
728
|
return qc_list_transpiled
|
|
766
729
|
|
|
730
|
+
@timeit
|
|
731
|
+
def append_rms(
|
|
732
|
+
self,
|
|
733
|
+
num_rms: int,
|
|
734
|
+
qubit_layout: List[int],
|
|
735
|
+
) -> List[QuantumCircuit]:
|
|
736
|
+
"""
|
|
737
|
+
Appends 1Q Clifford gates sampled uniformly at random to all qubits in the given circuit.
|
|
738
|
+
Args:
|
|
739
|
+
num_rms (int):
|
|
740
|
+
How many randomized measurement circuits are generated
|
|
741
|
+
qubit_layout List[int]:
|
|
742
|
+
The subset of system-qubits used in the protocol, indexed from 0
|
|
743
|
+
Returns:
|
|
744
|
+
List[QuantumCircuit] of the original circuit with 1Q Clifford gates appended to it
|
|
745
|
+
"""
|
|
746
|
+
idx = BenchmarkObservationIdentifier(qubit_layout).string_identifier
|
|
747
|
+
fixed_coupling_map = set_coupling_map(qubit_layout, self.backend, "fixed")
|
|
748
|
+
circuit = self.circuits["untranspiled_circuits"][f"{qubit_layout}_native_ghz"].circuits[0]
|
|
749
|
+
rm_circuits: list[QuantumCircuit] = []
|
|
750
|
+
for _ in range(num_rms):
|
|
751
|
+
rm_circ = circuit.copy()
|
|
752
|
+
# It shouldn't matter if measurement bits get scrambled
|
|
753
|
+
rm_circ.remove_final_measurements()
|
|
754
|
+
rm_circ.barrier()
|
|
755
|
+
|
|
756
|
+
active_qubits = set()
|
|
757
|
+
data = rm_circ.data
|
|
758
|
+
for instruction in data:
|
|
759
|
+
for qubit in instruction[1]:
|
|
760
|
+
active_qubits.add(rm_circ.find_bit(qubit)[0])
|
|
761
|
+
for q in active_qubits:
|
|
762
|
+
if self.backend is not None:
|
|
763
|
+
rand_clifford = random_clifford(1).to_circuit()
|
|
764
|
+
else:
|
|
765
|
+
rand_clifford = random_clifford(1).to_instruction()
|
|
766
|
+
rm_circ.compose(rand_clifford, qubits=[q], inplace=True)
|
|
767
|
+
|
|
768
|
+
rm_circ.measure_active()
|
|
769
|
+
rm_circuits.append(rm_circ)
|
|
770
|
+
|
|
771
|
+
rm_circuits_transpiled, _ = perform_backend_transpilation(
|
|
772
|
+
rm_circuits,
|
|
773
|
+
self.backend,
|
|
774
|
+
qubit_layout,
|
|
775
|
+
fixed_coupling_map,
|
|
776
|
+
qiskit_optim_level=self.qiskit_optim_level,
|
|
777
|
+
optimize_sqg=self.optimize_sqg,
|
|
778
|
+
)
|
|
779
|
+
untranspiled_rm_group = CircuitGroup(circuits=rm_circuits, name=f"{idx}_rm_circuits")
|
|
780
|
+
self.circuits["untranspiled_circuits"].circuit_groups.append(untranspiled_rm_group)
|
|
781
|
+
|
|
782
|
+
return rm_circuits_transpiled
|
|
783
|
+
|
|
767
784
|
def generate_readout_circuit(self, qubit_layout: List[int], qubit_count: int) -> CircuitGroup:
|
|
768
785
|
"""
|
|
769
786
|
A wrapper for the creation of different circuits to estimate the fidelity
|
|
@@ -788,9 +805,7 @@ class GHZBenchmark(Benchmark):
|
|
|
788
805
|
|
|
789
806
|
match self.fidelity_routine:
|
|
790
807
|
case "randomized_measurements":
|
|
791
|
-
all_circuits_list, _ = append_rms(
|
|
792
|
-
transpiled_ghz_group.circuits[0], cast(int, self.num_RMs), self.backend
|
|
793
|
-
)
|
|
808
|
+
all_circuits_list, _ = self.append_rms(cast(int, self.num_RMs), qubit_layout)
|
|
794
809
|
transpiled_ghz_group.circuits = all_circuits_list
|
|
795
810
|
case "coherences":
|
|
796
811
|
all_circuits_list = self.generate_coherence_meas_circuits(qubit_layout, qubit_count)
|
|
@@ -847,7 +862,6 @@ class GHZBenchmark(Benchmark):
|
|
|
847
862
|
)
|
|
848
863
|
|
|
849
864
|
# Retrieve all
|
|
850
|
-
qcvv_logger.info(f"Retrieving counts and adding counts to dataset...")
|
|
851
865
|
for qubit_layout in aux_custom_qubits_array:
|
|
852
866
|
# for qubit_count in self.qubit_counts[idx]:
|
|
853
867
|
Id = BenchmarkObservationIdentifier(qubit_layout)
|
|
@@ -833,14 +833,21 @@ class QScoreBenchmark(Benchmark):
|
|
|
833
833
|
qc_list.append([])
|
|
834
834
|
qcvv_logger.debug(f"This graph instance has no edges.")
|
|
835
835
|
else:
|
|
836
|
-
# execute for a given num_node and a given instance
|
|
837
|
-
coupling_map = self.backend.coupling_map.reduce(qubit_set)
|
|
838
836
|
qcvv_logger.setLevel(logging.WARNING)
|
|
837
|
+
# Account for all-to-all connected backends like Deneb
|
|
838
|
+
if "move" in self.backend.operation_names:
|
|
839
|
+
# If the circuit is defined on a subset of qubit_set, choose the first qubtis in the set
|
|
840
|
+
active_qubit_set = qubit_set[: len(qc.qubits)]
|
|
841
|
+
# All-to-all coupling map on the active qubits
|
|
842
|
+
effective_coupling_map = [[x, y] for x in active_qubit_set for y in active_qubit_set if x != y]
|
|
843
|
+
else:
|
|
844
|
+
active_qubit_set = qubit_set
|
|
845
|
+
effective_coupling_map = self.backend.coupling_map.reduce(active_qubit_set)
|
|
839
846
|
transpiled_qc, _ = perform_backend_transpilation(
|
|
840
847
|
[qc],
|
|
841
848
|
backend=self.backend,
|
|
842
|
-
qubits=
|
|
843
|
-
coupling_map=
|
|
849
|
+
qubits=active_qubit_set,
|
|
850
|
+
coupling_map=effective_coupling_map,
|
|
844
851
|
qiskit_optim_level=self.qiskit_optim_level,
|
|
845
852
|
optimize_sqg=self.optimize_sqg,
|
|
846
853
|
routing_method=self.routing_method,
|
|
@@ -502,8 +502,8 @@ class CLOPSBenchmark(Benchmark):
|
|
|
502
502
|
# Update parameters
|
|
503
503
|
parameters = self.generate_random_parameters()
|
|
504
504
|
|
|
505
|
-
#
|
|
506
|
-
if optimize_sqg and self.backend.
|
|
505
|
+
# Star can't use optimize_sqg as is, yet -> complains about MOVE gate not being IQM native!
|
|
506
|
+
if optimize_sqg and "move" not in self.backend.operation_names:
|
|
507
507
|
sorted_dict_parametrized[k].append(
|
|
508
508
|
optimize_single_qubit_gates( # Optimize SQG seems worth it AFTER assignment
|
|
509
509
|
qc.assign_parameters(
|
|
@@ -128,6 +128,12 @@ def clifford_rb_analysis(run: BenchmarkRunResult) -> BenchmarkAnalysisResult:
|
|
|
128
128
|
"avg_gate_fidelity": {"value": fidelity.value, "uncertainty": fidelity.stderr},
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
if len(qubits) == 1:
|
|
132
|
+
fidelity_native = rb_fit_results.params["fidelity_per_native_sqg"]
|
|
133
|
+
processed_results.update(
|
|
134
|
+
{"avg_native_gate_fidelity": {"value": fidelity_native.value, "uncertainty": fidelity_native.stderr}}
|
|
135
|
+
)
|
|
136
|
+
|
|
131
137
|
dataset.attrs[qubits_idx].update(
|
|
132
138
|
{
|
|
133
139
|
"decay_rate": {"value": popt["decay_rate"].value, "uncertainty": popt["decay_rate"].stderr},
|
|
@@ -75,6 +75,11 @@ def interleaved_rb_analysis(run: BenchmarkRunResult) -> BenchmarkAnalysisResult:
|
|
|
75
75
|
|
|
76
76
|
interleaved_gate = dataset.attrs["interleaved_gate"]
|
|
77
77
|
interleaved_gate_parameters = dataset.attrs["interleaved_gate_params"]
|
|
78
|
+
if interleaved_gate_parameters is None:
|
|
79
|
+
interleaved_gate_string = f"{interleaved_gate}"
|
|
80
|
+
else:
|
|
81
|
+
params_string = str(tuple(f"{x:.2f}" for x in interleaved_gate_parameters))
|
|
82
|
+
interleaved_gate_string = f"{interleaved_gate}{params_string}"
|
|
78
83
|
|
|
79
84
|
simultaneous_fit = dataset.attrs["simultaneous_fit"]
|
|
80
85
|
|
|
@@ -138,6 +143,7 @@ def interleaved_rb_analysis(run: BenchmarkRunResult) -> BenchmarkAnalysisResult:
|
|
|
138
143
|
[list_of_fidelities_clifford, list_of_fidelities_interleaved],
|
|
139
144
|
"interleaved",
|
|
140
145
|
simultaneous_fit,
|
|
146
|
+
interleaved_gate_string,
|
|
141
147
|
)
|
|
142
148
|
rb_fit_results = lmfit_minimizer(fit_parameters, fit_data, sequence_lengths, exponential_rb)
|
|
143
149
|
|
|
@@ -170,10 +176,31 @@ def interleaved_rb_analysis(run: BenchmarkRunResult) -> BenchmarkAnalysisResult:
|
|
|
170
176
|
"avg_gate_fidelity": {"value": fidelity.value, "uncertainty": fidelity.stderr},
|
|
171
177
|
}
|
|
172
178
|
|
|
179
|
+
if len(qubits) == 1 and rb_type == "clifford":
|
|
180
|
+
fidelity_native = rb_fit_results.params["fidelity_per_native_sqg"]
|
|
181
|
+
processed_results[rb_type].update(
|
|
182
|
+
{
|
|
183
|
+
"avg_gate_fidelity_native": {
|
|
184
|
+
"value": fidelity_native.value,
|
|
185
|
+
"uncertainty": fidelity_native.stderr,
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
elif len(qubits) == 2 and rb_type == "clifford" and interleaved_gate_string == "CZGate":
|
|
190
|
+
fidelity_native_sqg = rb_fit_results.params["fidelity_per_native_sqg"]
|
|
191
|
+
processed_results[rb_type].update(
|
|
192
|
+
{
|
|
193
|
+
"avg_gate_fidelity_native_sqg": {
|
|
194
|
+
"value": fidelity_native_sqg.value,
|
|
195
|
+
"uncertainty": fidelity_native_sqg.stderr,
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
|
|
173
200
|
observations.extend(
|
|
174
201
|
[
|
|
175
202
|
BenchmarkObservation(
|
|
176
|
-
name=f"{key}_{rb_type}",
|
|
203
|
+
name=f"{key}_{rb_type}" if "native" not in key else f"{key}",
|
|
177
204
|
identifier=BenchmarkObservationIdentifier(qubits),
|
|
178
205
|
value=values["value"],
|
|
179
206
|
uncertainty=values["uncertainty"],
|
|
@@ -206,12 +233,6 @@ def interleaved_rb_analysis(run: BenchmarkRunResult) -> BenchmarkAnalysisResult:
|
|
|
206
233
|
obs_dict.update({qubits_idx: processed_results})
|
|
207
234
|
|
|
208
235
|
# Generate decay plots
|
|
209
|
-
if interleaved_gate_parameters is None:
|
|
210
|
-
interleaved_gate_string = f"{interleaved_gate}"
|
|
211
|
-
else:
|
|
212
|
-
params_string = str(tuple(f"{x:.2f}" for x in interleaved_gate_parameters))
|
|
213
|
-
interleaved_gate_string = f"{interleaved_gate}{params_string}"
|
|
214
|
-
|
|
215
236
|
fig_name, fig = plot_rb_decay(
|
|
216
237
|
"irb",
|
|
217
238
|
[qubits],
|
|
@@ -29,6 +29,7 @@ from iqm.benchmarks.randomized_benchmarking.randomized_benchmarking_common impor
|
|
|
29
29
|
)
|
|
30
30
|
from iqm.benchmarks.utils import (
|
|
31
31
|
get_iqm_backend,
|
|
32
|
+
perform_backend_transpilation,
|
|
32
33
|
retrieve_all_counts,
|
|
33
34
|
retrieve_all_job_metadata,
|
|
34
35
|
submit_execute,
|
|
@@ -326,16 +327,22 @@ def generate_pauli_dressed_mrb_circuits(
|
|
|
326
327
|
|
|
327
328
|
# Add measurements to transpiled - before!
|
|
328
329
|
circ.measure_all()
|
|
329
|
-
|
|
330
|
-
|
|
330
|
+
if "move" in retrieved_backend.operation_names:
|
|
331
|
+
# All-to-all coupling map on the active qubits
|
|
332
|
+
effective_coupling_map = [[x, y] for x in qubits for y in qubits if x != y]
|
|
333
|
+
else:
|
|
334
|
+
effective_coupling_map = retrieved_backend.coupling_map
|
|
335
|
+
circ_transpiled, _ = perform_backend_transpilation(
|
|
336
|
+
[circ],
|
|
331
337
|
backend=retrieved_backend,
|
|
332
|
-
|
|
333
|
-
|
|
338
|
+
qubits=qubits,
|
|
339
|
+
coupling_map=effective_coupling_map,
|
|
340
|
+
qiskit_optim_level=qiskit_optim_level,
|
|
334
341
|
routing_method=routing_method,
|
|
335
342
|
)
|
|
336
343
|
|
|
337
344
|
pauli_dressed_circuits_untranspiled.append(circ_untranspiled)
|
|
338
|
-
pauli_dressed_circuits_transpiled.append(circ_transpiled)
|
|
345
|
+
pauli_dressed_circuits_transpiled.append(circ_transpiled[0])
|
|
339
346
|
|
|
340
347
|
# Store the circuit
|
|
341
348
|
all_circuits.update(
|
|
@@ -89,6 +89,7 @@ def fit_decay_lmfit(
|
|
|
89
89
|
data: List[List[float]] | List[List[List[float]]],
|
|
90
90
|
rb_identifier: str,
|
|
91
91
|
simultaneous_fit_vars: Optional[List[str]] = None,
|
|
92
|
+
interleaved_gate_str: Optional[str] = None,
|
|
92
93
|
) -> Tuple[np.ndarray, Parameters]:
|
|
93
94
|
"""Perform a fitting routine for 0th-order (Ap^m+B) RB using lmfit
|
|
94
95
|
|
|
@@ -98,6 +99,7 @@ def fit_decay_lmfit(
|
|
|
98
99
|
data (List[List[float]] | List[List[List[float]]]): the data to be fitted
|
|
99
100
|
rb_identifier (str): the RB identifier, either "stdrb", "irb" or "mrb"
|
|
100
101
|
simultaneous_fit_vars (List[str], optional): the list of variables used to fit simultaneously
|
|
102
|
+
interleaved_gate_str (Optional[str]): the name of the interleaved gate in IRB
|
|
101
103
|
Returns:
|
|
102
104
|
A tuple of fitting data (list of lists of average fidelities or polarizations) and MRB fit parameters
|
|
103
105
|
"""
|
|
@@ -125,6 +127,12 @@ def fit_decay_lmfit(
|
|
|
125
127
|
)
|
|
126
128
|
params.add(f"p_rb", expr=f"1-depolarization_probability_{1}")
|
|
127
129
|
params.add(f"fidelity_per_clifford", expr=f"p_rb + (1 - p_rb) / (2**{n_qubits})")
|
|
130
|
+
if n_qubits == 1:
|
|
131
|
+
# The construction of the 1Q and 2Q Clifford gate dictionaries in "generate_2qubit_cliffords.ipynb"
|
|
132
|
+
# is based on the reference below; thus the expected amount of 1.875 native gates per Clifford
|
|
133
|
+
# Native gate set being {I, X(pi/2), X(pi), X(-pi/2), Y(pi/2), Y(pi), Y(-pi)} with X(a)=r(a,0), Y(a)=r(a,pi/2)
|
|
134
|
+
# Ref: Barends et al., Nature 508, 500-503 (2014); Eq.(S3) of arXiv:1402.4848 [quant-ph]
|
|
135
|
+
params.add("fidelity_per_native_sqg", expr=f"1 - (1 - (p_rb + (1 - p_rb) / (2**{n_qubits})))/1.875")
|
|
128
136
|
else:
|
|
129
137
|
params = create_multi_dataset_params(
|
|
130
138
|
func, fit_data, initial_guesses=None, constraints=constraints, simultaneously_fit_vars=None
|
|
@@ -140,10 +148,24 @@ def fit_decay_lmfit(
|
|
|
140
148
|
constraints=None,
|
|
141
149
|
simultaneously_fit_vars=simultaneous_fit_vars,
|
|
142
150
|
)
|
|
143
|
-
params.add(f"p_rb", expr=f"1-depolarization_probability_{1}")
|
|
144
|
-
params.add(f"fidelity_per_clifford", expr=f"p_rb + (1 - p_rb) / (2**{n_qubits})")
|
|
145
|
-
params.add(f"p_irb", expr=f"1-depolarization_probability_{2}")
|
|
146
|
-
params.add(f"interleaved_fidelity", expr=f"p_irb / p_rb + (1 - p_irb / p_rb) / (2**{n_qubits})")
|
|
151
|
+
params.add(f"p_rb", expr=f"1.0 - depolarization_probability_{1}")
|
|
152
|
+
params.add(f"fidelity_per_clifford", expr=f"p_rb + (1.0 - p_rb) / (2.0**{n_qubits})")
|
|
153
|
+
params.add(f"p_irb", expr=f"1.0 - depolarization_probability_{2}")
|
|
154
|
+
params.add(f"interleaved_fidelity", expr=f"p_irb / p_rb + (1.0 - p_irb / p_rb) / (2.0**{n_qubits})")
|
|
155
|
+
if n_qubits == 1:
|
|
156
|
+
# The construction of the 1Q and 2Q Clifford gate dictionaries in "generate_2qubit_cliffords.ipynb"
|
|
157
|
+
# is based on the reference below; thus the expected amount of 1.875 native gates per Clifford
|
|
158
|
+
# Native gate set being {I, X(pi/2), X(pi), X(-pi/2), Y(pi/2), Y(pi), Y(-pi)} with X(a)=r(a,0), Y(a)=r(a,pi/2)
|
|
159
|
+
# Ref: Barends et al., Nature 508, 500-503 (2014); Eq.(S3) of arXiv:1402.4848 [quant-ph]
|
|
160
|
+
# For IRB it may be used as proxy to how well (or bad) the assumption of uniform fidelity in native sqg gates holds.
|
|
161
|
+
params.add("fidelity_per_native_sqg", expr=f"1.0 - (1.0 - fidelity_per_clifford)/1.875")
|
|
162
|
+
elif n_qubits == 2 and interleaved_gate_str == "CZGate":
|
|
163
|
+
# Here similarly, we may use Eq.(S8 - S11) of arXiv:1402.4848 [quant-ph]
|
|
164
|
+
params.add(f"fidelity_clifford_and_interleaved", expr=f"p_irb + (1.0 - p_irb) / (2.0 ** {n_qubits})")
|
|
165
|
+
params.add(
|
|
166
|
+
"fidelity_per_native_sqg",
|
|
167
|
+
expr=f"(1.0 / 33.0) * (4.0 * fidelity_clifford_and_interleaved - 10.0 * interleaved_fidelity + 39.0)",
|
|
168
|
+
)
|
|
147
169
|
|
|
148
170
|
return fit_data, params
|
|
149
171
|
|
|
@@ -578,6 +600,8 @@ def plot_rb_decay(
|
|
|
578
600
|
stddevs_from_mean = {}
|
|
579
601
|
fidelity_value = {}
|
|
580
602
|
fidelity_stderr = {}
|
|
603
|
+
fidelity_native1q_value = {}
|
|
604
|
+
fidelity_native1q_stderr = {}
|
|
581
605
|
decay_rate = {}
|
|
582
606
|
offset = {}
|
|
583
607
|
amplitude = {}
|
|
@@ -618,6 +642,14 @@ def plot_rb_decay(
|
|
|
618
642
|
str(q): dataset.attrs[q_idx]["avg_fidelities_stderr"]
|
|
619
643
|
for q_idx, q in enumerate(qubits_array, qubits_index)
|
|
620
644
|
}
|
|
645
|
+
fidelity_native1q_value[identifier] = {
|
|
646
|
+
str(q): observations[q_idx]["avg_native_gate_fidelity"]["value"] if len(q) == 1 else np.nan
|
|
647
|
+
for q_idx, q in enumerate(qubits_array, qubits_index)
|
|
648
|
+
}
|
|
649
|
+
fidelity_native1q_stderr[identifier] = {
|
|
650
|
+
str(q): observations[q_idx]["avg_native_gate_fidelity"]["uncertainty"] if len(q) == 1 else np.nan
|
|
651
|
+
for q_idx, q in enumerate(qubits_array, qubits_index)
|
|
652
|
+
}
|
|
621
653
|
# These are common to both MRB and standard Clifford
|
|
622
654
|
fidelity_value[identifier] = {
|
|
623
655
|
str(q): observations[q_idx]["avg_gate_fidelity"]["value"]
|
|
@@ -636,7 +668,7 @@ def plot_rb_decay(
|
|
|
636
668
|
amplitude[identifier] = {
|
|
637
669
|
str(q): dataset.attrs[q_idx]["fit_amplitude"]["value"] for q_idx, q in enumerate(qubits_array, qubits_index)
|
|
638
670
|
}
|
|
639
|
-
else: # id
|
|
671
|
+
else: # id IRB
|
|
640
672
|
rb_type_keys = list(observations[0].keys())
|
|
641
673
|
colors = [cmap(i) for i in np.linspace(start=1, stop=0, num=len(rb_type_keys)).tolist()]
|
|
642
674
|
for rb_type in rb_type_keys:
|
|
@@ -791,12 +823,12 @@ def plot_rb_decay(
|
|
|
791
823
|
if identifier == "mrb":
|
|
792
824
|
plot_label = fr"$\overline{{F}}_{{MRB}} (n={len(qubits)})$ = {100.0 * fidelity_value[key][str(qubits)]:.2f} +/- {100.0 * fidelity_stderr[key][str(qubits)]:.2f} (%)"
|
|
793
825
|
elif key == "interleaved":
|
|
794
|
-
plot_label = fr"$\overline{{F}}_{{{interleaved_gate}}}
|
|
795
|
-
else:
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
826
|
+
plot_label = fr"$\overline{{F}}_{{{interleaved_gate}}}$ = {100.0 * fidelity_value[key][str(qubits)]:.2f} +/- {100.0 * fidelity_stderr[key][str(qubits)]:.2f} (%)"
|
|
827
|
+
else: # if id is "clifford"
|
|
828
|
+
if len(qubits) == 1 and identifier != "irb":
|
|
829
|
+
plot_label = fr"$\overline{{F}}_{{native\_sqg}} \simeq$ {100.0 * fidelity_native1q_value[key][str(qubits)]:.2f} +/- {100.0 * fidelity_native1q_stderr[key][str(qubits)]:.2f} (%)"
|
|
830
|
+
else:
|
|
831
|
+
plot_label = fr"$\overline{{F}}_{{CRB}}$ = {100.0 * fidelity_value[key][str(qubits)]:.2f} +/- {100.0 * fidelity_stderr[key][str(qubits)]:.2f} (%)"
|
|
800
832
|
|
|
801
833
|
ax.plot(
|
|
802
834
|
x_linspace,
|
iqm/benchmarks/utils.py
CHANGED
|
@@ -230,6 +230,9 @@ def perform_backend_transpilation(
|
|
|
230
230
|
|
|
231
231
|
Returns:
|
|
232
232
|
List[QuantumCircuit]: A list of transpiled quantum circuits.
|
|
233
|
+
|
|
234
|
+
Raises:
|
|
235
|
+
ValueError: if Star topology and label 0 is in qubit layout.
|
|
233
236
|
"""
|
|
234
237
|
|
|
235
238
|
# Helper function considering whether optimize_sqg is done,
|
|
@@ -245,13 +248,18 @@ def perform_backend_transpilation(
|
|
|
245
248
|
)
|
|
246
249
|
if optimize_sqg:
|
|
247
250
|
transpiled = optimize_single_qubit_gates(transpiled, drop_final_rz=drop_final_rz)
|
|
248
|
-
if backend.
|
|
251
|
+
if "move" in backend.operation_names:
|
|
249
252
|
transpiled = transpile_to_IQM(
|
|
250
253
|
transpiled, backend=backend, optimize_single_qubits=optimize_sqg, remove_final_rzs=drop_final_rz
|
|
251
254
|
)
|
|
252
255
|
if aux_qc is not None:
|
|
253
|
-
if backend.
|
|
254
|
-
|
|
256
|
+
if "move" in backend.operation_names:
|
|
257
|
+
if 0 in qubits:
|
|
258
|
+
raise ValueError(
|
|
259
|
+
"Label 0 is reserved for Resonator - Please specify computational qubit labels (1,2,...)"
|
|
260
|
+
)
|
|
261
|
+
backend_name = "IQMNdonisBackend"
|
|
262
|
+
transpiled = reduce_to_active_qubits(transpiled, backend_name)
|
|
255
263
|
transpiled = aux_qc.compose(transpiled, qubits=[0] + qubits, clbits=list(range(qc.num_clbits)))
|
|
256
264
|
else:
|
|
257
265
|
transpiled = aux_qc.compose(transpiled, qubits=qubits, clbits=list(range(qc.num_clbits)))
|
|
@@ -384,9 +392,17 @@ def set_coupling_map(
|
|
|
384
392
|
* Default is "fixed".
|
|
385
393
|
Returns:
|
|
386
394
|
A coupling map according to the specified physical layout.
|
|
395
|
+
|
|
396
|
+
Raises:
|
|
397
|
+
ValueError: if Star topology and label 0 is in qubit layout.
|
|
398
|
+
ValueError: if the physical layout is not "fixed" or "batching".
|
|
387
399
|
"""
|
|
388
400
|
if physical_layout == "fixed":
|
|
389
|
-
if backend.
|
|
401
|
+
if "move" in backend.operation_names:
|
|
402
|
+
if 0 in qubits:
|
|
403
|
+
raise ValueError(
|
|
404
|
+
"Label 0 is reserved for Resonator - Please specify computational qubit labels (1,2,...)"
|
|
405
|
+
)
|
|
390
406
|
return backend.coupling_map.reduce(mapping=[0] + list(qubits))
|
|
391
407
|
return backend.coupling_map.reduce(mapping=qubits)
|
|
392
408
|
if physical_layout == "batching":
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: iqm-benchmarks
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.12
|
|
4
4
|
Summary: A package for implementation of Quantum Characterization, Verification and Validation (QCVV) techniques on IQM's hardware at gate level abstraction
|
|
5
5
|
Author-email: IQM Finland Oy <developers@meetiqm.com>, Aniket Rath <aniket.rath@meetiqm.com>, Jami Rönkkö <jami@meetiqm.com>, Pedro Figueroa Romero <pedro.romero@meetiqm.com>, Vicente Pina Canelles <vicente.pina@meetiqm.com>, Raphael Brieger <raphael.brieger@meetiqm.com>, Stefan Seegerer <stefan.seegerer@meetiqm.com>, Miikka Koistinen <miikka@meetiqm.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/iqm-finland/iqm-benchmarks
|
|
@@ -4,28 +4,28 @@ iqm/benchmarks/benchmark_definition.py,sha256=AZkvANrf0_0glbq_P_uo_YqbBU9IZa2gJl
|
|
|
4
4
|
iqm/benchmarks/circuit_containers.py,sha256=anEtZEsodYqOX-34oZRmuKGeEpp_VfgG5045Mz4-4hI,7562
|
|
5
5
|
iqm/benchmarks/logging_config.py,sha256=U7olP5Kr75AcLJqNODf9VBhJLVqIvA4AYR6J39D5rww,1052
|
|
6
6
|
iqm/benchmarks/readout_mitigation.py,sha256=7FlbSH-RJTtQuRYLChwkQV_vBv0ZfMQTH519cAbyxQ4,12252
|
|
7
|
-
iqm/benchmarks/utils.py,sha256=
|
|
7
|
+
iqm/benchmarks/utils.py,sha256=q4U3nuIOyLHhft8ixDXtV48KGm0uiV4tdtlWpGM1O1M,21180
|
|
8
8
|
iqm/benchmarks/compressive_gst/__init__.py,sha256=LneifgYXtcwo2jcXo7GdUEHL6_peipukShhkrdaTRCA,929
|
|
9
|
-
iqm/benchmarks/compressive_gst/compressive_gst.py,sha256=
|
|
9
|
+
iqm/benchmarks/compressive_gst/compressive_gst.py,sha256=spq6jP0NLbjaJDzESpbfRPs0N_YheFWl2Wa6USHS5sI,22398
|
|
10
10
|
iqm/benchmarks/compressive_gst/gst_analysis.py,sha256=PxCThBfh2zdQpipI-6gAvLKdmkbYv_KSEpejltVkk7o,35330
|
|
11
11
|
iqm/benchmarks/entanglement/__init__.py,sha256=9T7prOwqMmFWdb4t6ETAHZXKK5o6FvU2DvVb6WhNi-U,682
|
|
12
|
-
iqm/benchmarks/entanglement/ghz.py,sha256=
|
|
12
|
+
iqm/benchmarks/entanglement/ghz.py,sha256=oNf4TE7zEh0fgmz6RaJG0luZZNc6h2Dgohf9KLGKryc,41251
|
|
13
13
|
iqm/benchmarks/optimization/__init__.py,sha256=_ajW_OibYLCtzU5AUv5c2zuuVYn8ZNeZUcUUSIGt51M,747
|
|
14
|
-
iqm/benchmarks/optimization/qscore.py,sha256=
|
|
14
|
+
iqm/benchmarks/optimization/qscore.py,sha256=8y3MTCGXkVIMqSs9fGRwBENOvISSFBKLBoATc893yVk,35164
|
|
15
15
|
iqm/benchmarks/quantum_volume/__init__.py,sha256=i-Q4SpDWELBw7frXnxm1j4wJRcxbIyrS5uEK_v06YHo,951
|
|
16
|
-
iqm/benchmarks/quantum_volume/clops.py,sha256=
|
|
16
|
+
iqm/benchmarks/quantum_volume/clops.py,sha256=aLxq2sC6cvRmtbmgr7TvluE2edkARH_ZzpTD1LEQEjw,30957
|
|
17
17
|
iqm/benchmarks/quantum_volume/quantum_volume.py,sha256=njX5lBty9jcWMuJnl7uNqRfwE9akMe5gcX-f1_uYDXk,36791
|
|
18
18
|
iqm/benchmarks/randomized_benchmarking/__init__.py,sha256=IkKo-7zUChxZZd3my_csQCJfJfZNsV3-JTvdG8uqys4,734
|
|
19
19
|
iqm/benchmarks/randomized_benchmarking/clifford_1q.pkl,sha256=vvSd0pRWxtzyirohO9yf_58mjevkc2-pbuWIEb-4gaw,46928
|
|
20
20
|
iqm/benchmarks/randomized_benchmarking/clifford_2q.pkl,sha256=ZipqU3crPhz2T35qGFgB4GvMyoi_7pnu8NqW5ZP8NXg,90707258
|
|
21
21
|
iqm/benchmarks/randomized_benchmarking/multi_lmfit.py,sha256=Se1ygR4mXn_2_P82Ch31KBnCmY-g_A9NKzE9Ir8nEvw,3247
|
|
22
|
-
iqm/benchmarks/randomized_benchmarking/randomized_benchmarking_common.py,sha256=
|
|
22
|
+
iqm/benchmarks/randomized_benchmarking/randomized_benchmarking_common.py,sha256=xMiQyikGEVj3zoFQfVMS50K15MszArc0kiBWvZ7gWL8,41492
|
|
23
23
|
iqm/benchmarks/randomized_benchmarking/clifford_rb/__init__.py,sha256=bTDA156LAl7OLGcMec--1nzDrV1XpPRVq3CquTmucgE,677
|
|
24
|
-
iqm/benchmarks/randomized_benchmarking/clifford_rb/clifford_rb.py,sha256=
|
|
24
|
+
iqm/benchmarks/randomized_benchmarking/clifford_rb/clifford_rb.py,sha256=v8GDsEC3JscZVJXc6ZqfJaaSb1LocdFTSeOcwHxp50Y,18317
|
|
25
25
|
iqm/benchmarks/randomized_benchmarking/interleaved_rb/__init__.py,sha256=sq6MgN_hwlpkOj10vyCU4e6eKSX-oLcF2L9na6W2Gt4,681
|
|
26
|
-
iqm/benchmarks/randomized_benchmarking/interleaved_rb/interleaved_rb.py,sha256=
|
|
26
|
+
iqm/benchmarks/randomized_benchmarking/interleaved_rb/interleaved_rb.py,sha256=4hBjIXxqy18WKC8hgpCU6T6Vv2cvJu4AImj7QQDqI1k,27956
|
|
27
27
|
iqm/benchmarks/randomized_benchmarking/mirror_rb/__init__.py,sha256=ZekEqI_89nXzGO1vjM-b5Uwwicy59M4fYHXfA-f0MIg,674
|
|
28
|
-
iqm/benchmarks/randomized_benchmarking/mirror_rb/mirror_rb.py,sha256=
|
|
28
|
+
iqm/benchmarks/randomized_benchmarking/mirror_rb/mirror_rb.py,sha256=hAAvuQPmIBELeqLu-d33gIEAKTk57M8EB8vMUQkXXfI,34376
|
|
29
29
|
mGST/LICENSE,sha256=TtHNq55cUcbglb7uhVudeBLUh_qPdUoAEvU0BBwFz-k,1098
|
|
30
30
|
mGST/README.md,sha256=v_5kw253csHF4-RfE-44KqFmBXIsSMRmOtN0AUPrRxE,5050
|
|
31
31
|
mGST/additional_fns.py,sha256=_SEJ10FRNM7_CroysT8hCLZTfpm6ZhEIDCY5zPTnhjo,31390
|
|
@@ -36,8 +36,8 @@ mGST/optimization.py,sha256=YHwkzIkYvsZOPjclR-BCQWh24jeqjuXp0BB0WX5Lwow,10559
|
|
|
36
36
|
mGST/qiskit_interface.py,sha256=L4H-4SdhP_bjSFFvpQoF1E7EyGbIJ_CI_y4a7_YEwmU,10102
|
|
37
37
|
mGST/reporting/figure_gen.py,sha256=6Xd8vwfy09hLY1YbJY6TRevuMsQSU4MsWqemly3ZO0I,12970
|
|
38
38
|
mGST/reporting/reporting.py,sha256=We1cccz9BKbITYcSlZHdmBGdjMWAa1xNZe5tKP-yh_E,26004
|
|
39
|
-
iqm_benchmarks-2.
|
|
40
|
-
iqm_benchmarks-2.
|
|
41
|
-
iqm_benchmarks-2.
|
|
42
|
-
iqm_benchmarks-2.
|
|
43
|
-
iqm_benchmarks-2.
|
|
39
|
+
iqm_benchmarks-2.12.dist-info/LICENSE,sha256=2Ncb40-hqkTil78RPv3-YiJfKaJ8te9USJgliKqIdSY,11558
|
|
40
|
+
iqm_benchmarks-2.12.dist-info/METADATA,sha256=rBsWY6e6O_75H7yPCxbdmtKSWgaQStE5NzajPE63PsU,10171
|
|
41
|
+
iqm_benchmarks-2.12.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
42
|
+
iqm_benchmarks-2.12.dist-info/top_level.txt,sha256=3G23Z-1LGf-IOzTCUl6QwWqiQ3USz25Zt90Ihq192to,9
|
|
43
|
+
iqm_benchmarks-2.12.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|