iqm-benchmarks 1.11__py3-none-any.whl → 2.0__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/__init__.py +1 -0
- iqm/benchmarks/benchmark_definition.py +15 -12
- iqm/benchmarks/benchmark_experiment.py +4 -4
- iqm/benchmarks/circuit_containers.py +221 -0
- iqm/benchmarks/compressive_gst/compressive_gst.py +11 -4
- iqm/benchmarks/entanglement/ghz.py +101 -89
- iqm/benchmarks/optimization/qscore.py +11 -8
- iqm/benchmarks/quantum_volume/clops.py +13 -32
- iqm/benchmarks/quantum_volume/quantum_volume.py +18 -19
- iqm/benchmarks/randomized_benchmarking/clifford_rb/clifford_rb.py +23 -14
- iqm/benchmarks/randomized_benchmarking/interleaved_rb/interleaved_rb.py +48 -30
- iqm/benchmarks/randomized_benchmarking/mirror_rb/mirror_rb.py +14 -31
- iqm/benchmarks/randomized_benchmarking/randomized_benchmarking_common.py +4 -3
- iqm/benchmarks/readout_mitigation.py +2 -1
- iqm/benchmarks/utils.py +2 -1
- {iqm_benchmarks-1.11.dist-info → iqm_benchmarks-2.0.dist-info}/METADATA +1 -1
- {iqm_benchmarks-1.11.dist-info → iqm_benchmarks-2.0.dist-info}/RECORD +21 -20
- mGST/qiskit_interface.py +1 -1
- {iqm_benchmarks-1.11.dist-info → iqm_benchmarks-2.0.dist-info}/LICENSE +0 -0
- {iqm_benchmarks-1.11.dist-info → iqm_benchmarks-2.0.dist-info}/WHEEL +0 -0
- {iqm_benchmarks-1.11.dist-info → iqm_benchmarks-2.0.dist-info}/top_level.txt +0 -0
|
@@ -25,14 +25,10 @@ import matplotlib.pyplot as plt
|
|
|
25
25
|
from mthree.classes import QuasiCollection
|
|
26
26
|
from mthree.utils import expval
|
|
27
27
|
import numpy as np
|
|
28
|
-
from qiskit import QuantumCircuit
|
|
29
28
|
from qiskit.circuit.library import QuantumVolume
|
|
30
29
|
from qiskit_aer import Aer
|
|
31
30
|
import xarray as xr
|
|
32
31
|
|
|
33
|
-
# import iqm.diqe.executors.dynamical_decoupling.dd_high_level as dd
|
|
34
|
-
# from iqm.diqe.executors.dynamical_decoupling.dynamical_decoupling_core import DDStrategy
|
|
35
|
-
# from iqm.diqe.mapomatic import evaluate_costs, get_calibration_fidelities, get_circuit, matching_layouts
|
|
36
32
|
from iqm.benchmarks.benchmark import BenchmarkConfigurationBase
|
|
37
33
|
from iqm.benchmarks.benchmark_definition import (
|
|
38
34
|
Benchmark,
|
|
@@ -42,6 +38,11 @@ from iqm.benchmarks.benchmark_definition import (
|
|
|
42
38
|
BenchmarkRunResult,
|
|
43
39
|
add_counts_to_dataset,
|
|
44
40
|
)
|
|
41
|
+
|
|
42
|
+
# import iqm.diqe.executors.dynamical_decoupling.dd_high_level as dd
|
|
43
|
+
# from iqm.diqe.executors.dynamical_decoupling.dynamical_decoupling_core import DDStrategy
|
|
44
|
+
# from iqm.diqe.mapomatic import evaluate_costs, get_calibration_fidelities, get_circuit, matching_layouts
|
|
45
|
+
from iqm.benchmarks.circuit_containers import BenchmarkCircuit, CircuitGroup, Circuits
|
|
45
46
|
from iqm.benchmarks.logging_config import qcvv_logger
|
|
46
47
|
from iqm.benchmarks.readout_mitigation import apply_readout_error_mitigation
|
|
47
48
|
from iqm.benchmarks.utils import ( # execute_with_dd,
|
|
@@ -55,6 +56,7 @@ from iqm.benchmarks.utils import ( # execute_with_dd,
|
|
|
55
56
|
timeit,
|
|
56
57
|
xrvariable_to_counts,
|
|
57
58
|
)
|
|
59
|
+
from iqm.qiskit_iqm import IQMCircuit as QuantumCircuit
|
|
58
60
|
from iqm.qiskit_iqm.iqm_backend import IQMBackendBase
|
|
59
61
|
|
|
60
62
|
|
|
@@ -322,13 +324,7 @@ def qv_analysis(run: BenchmarkRunResult) -> BenchmarkAnalysisResult:
|
|
|
322
324
|
# Retrieve other dataset values
|
|
323
325
|
dataset_dictionary = dataset.attrs[qubits_idx]
|
|
324
326
|
sorted_qc_list_indices = dataset_dictionary["sorted_qc_list_indices"]
|
|
325
|
-
|
|
326
|
-
transpiled_qc_list = []
|
|
327
|
-
untranspiled_circ_dataset = dataset.attrs["untranspiled_circuits"][str(qubits)]
|
|
328
|
-
qc_list = []
|
|
329
|
-
for key in transpiled_circ_dataset: # Keys (final layouts) are the same for transp/untransp
|
|
330
|
-
transpiled_qc_list.extend(transpiled_circ_dataset[key])
|
|
331
|
-
qc_list.extend(untranspiled_circ_dataset[key])
|
|
327
|
+
qc_list = run.circuits["transpiled_circuits"][str(qubits)].circuits
|
|
332
328
|
|
|
333
329
|
qv_results_type[str(qubits)] = dataset_dictionary["qv_results_type"]
|
|
334
330
|
depth[str(qubits)] = len(qubits)
|
|
@@ -738,13 +734,13 @@ class QuantumVolumeBenchmark(Benchmark):
|
|
|
738
734
|
sorted_qc_list_indices = {}
|
|
739
735
|
|
|
740
736
|
# Initialize the variable to contain the QV circuits of each layout
|
|
741
|
-
self.
|
|
742
|
-
self.
|
|
737
|
+
self.circuits = Circuits()
|
|
738
|
+
self.untranspiled_circuits = BenchmarkCircuit(name="untranspiled_circuits")
|
|
739
|
+
self.transpiled_circuits = BenchmarkCircuit(name="transpiled_circuits")
|
|
743
740
|
all_op_counts = {}
|
|
744
741
|
|
|
745
742
|
for qubits in self.custom_qubits_array: # NB: jobs will be submitted for qubit layouts in the specified order
|
|
746
|
-
|
|
747
|
-
self.transpiled_circuits[str(qubits)] = {}
|
|
743
|
+
|
|
748
744
|
num_qubits = len(qubits)
|
|
749
745
|
depth = num_qubits
|
|
750
746
|
qcvv_logger.info(f"Executing QV on qubits {qubits}")
|
|
@@ -781,8 +777,10 @@ class QuantumVolumeBenchmark(Benchmark):
|
|
|
781
777
|
else:
|
|
782
778
|
raise ValueError("physical_layout must either be \"fixed\" or \"batching\"")
|
|
783
779
|
|
|
784
|
-
self.untranspiled_circuits
|
|
785
|
-
self.transpiled_circuits
|
|
780
|
+
self.untranspiled_circuits.circuit_groups.append(CircuitGroup(name=str(qubits), circuits=qc_list))
|
|
781
|
+
self.transpiled_circuits.circuit_groups.append(
|
|
782
|
+
CircuitGroup(name=str(qubits), circuits=sorted_transpiled_qc_list[tuple(qubits)])
|
|
783
|
+
)
|
|
786
784
|
|
|
787
785
|
# Count operations
|
|
788
786
|
all_op_counts[str(qubits)] = count_native_gates(backend, transpiled_qc_list)
|
|
@@ -823,14 +821,15 @@ class QuantumVolumeBenchmark(Benchmark):
|
|
|
823
821
|
qcvv_logger.info(f"Adding counts of {qubits} run to the dataset")
|
|
824
822
|
dataset, _ = add_counts_to_dataset(execution_results, str(qubits), dataset)
|
|
825
823
|
|
|
826
|
-
self.
|
|
824
|
+
self.circuits = Circuits([self.transpiled_circuits, self.untranspiled_circuits])
|
|
827
825
|
|
|
828
826
|
if self.rem:
|
|
829
827
|
rem_quasidistros = {}
|
|
830
828
|
for qubits in self.custom_qubits_array:
|
|
831
829
|
exec_counts = xrvariable_to_counts(dataset, str(qubits), self.num_circuits)
|
|
832
830
|
rem_quasidistros[f"REM_quasidist_{str(qubits)}"] = self.get_rem_quasidistro(
|
|
833
|
-
self.transpiled_circuits[str(qubits)],
|
|
831
|
+
{tuple(qubits): self.transpiled_circuits[str(qubits)].circuits},
|
|
832
|
+
# self.transpiled_circuits[str(qubits)],
|
|
834
833
|
sorted_qc_list_indices[str(qubits)],
|
|
835
834
|
exec_counts,
|
|
836
835
|
self.mit_shots,
|
|
@@ -20,7 +20,6 @@ from time import strftime
|
|
|
20
20
|
from typing import Any, Dict, List, Sequence, Type
|
|
21
21
|
|
|
22
22
|
import numpy as np
|
|
23
|
-
from qiskit import QuantumCircuit
|
|
24
23
|
import xarray as xr
|
|
25
24
|
|
|
26
25
|
from iqm.benchmarks.benchmark import BenchmarkConfigurationBase
|
|
@@ -32,6 +31,7 @@ from iqm.benchmarks.benchmark_definition import (
|
|
|
32
31
|
BenchmarkRunResult,
|
|
33
32
|
add_counts_to_dataset,
|
|
34
33
|
)
|
|
34
|
+
from iqm.benchmarks.circuit_containers import BenchmarkCircuit, CircuitGroup, Circuits
|
|
35
35
|
from iqm.benchmarks.logging_config import qcvv_logger
|
|
36
36
|
from iqm.benchmarks.randomized_benchmarking.randomized_benchmarking_common import (
|
|
37
37
|
exponential_rb,
|
|
@@ -48,6 +48,7 @@ from iqm.benchmarks.randomized_benchmarking.randomized_benchmarking_common impor
|
|
|
48
48
|
validate_rb_qubits,
|
|
49
49
|
)
|
|
50
50
|
from iqm.benchmarks.utils import retrieve_all_counts, retrieve_all_job_metadata, timeit, xrvariable_to_counts
|
|
51
|
+
from iqm.qiskit_iqm import IQMCircuit as QuantumCircuit
|
|
51
52
|
from iqm.qiskit_iqm.iqm_backend import IQMBackendBase
|
|
52
53
|
|
|
53
54
|
|
|
@@ -242,8 +243,8 @@ class CliffordRandomizedBenchmarking(Benchmark):
|
|
|
242
243
|
time_circuit_generation: Dict[str, float] = {}
|
|
243
244
|
|
|
244
245
|
# Initialize the variable to contain the circuits for each layout
|
|
245
|
-
self.untranspiled_circuits
|
|
246
|
-
self.transpiled_circuits
|
|
246
|
+
self.untranspiled_circuits = BenchmarkCircuit("untranspiled_circuits")
|
|
247
|
+
self.transpiled_circuits = BenchmarkCircuit("transpiled_circuits")
|
|
247
248
|
|
|
248
249
|
# Auxiliary dict from str(qubits) to indices
|
|
249
250
|
qubit_idx: Dict[str, Any] = {}
|
|
@@ -291,13 +292,18 @@ class CliffordRandomizedBenchmarking(Benchmark):
|
|
|
291
292
|
)
|
|
292
293
|
qcvv_logger.info(f"Job for sequence length {seq_length} submitted successfully!")
|
|
293
294
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
295
|
+
self.untranspiled_circuits.circuit_groups.append(
|
|
296
|
+
CircuitGroup(
|
|
297
|
+
name=f"{str(self.qubits_array)}_length_{seq_length}",
|
|
298
|
+
circuits=parallel_untranspiled_rb_circuits[seq_length],
|
|
299
|
+
)
|
|
300
|
+
)
|
|
301
|
+
self.transpiled_circuits.circuit_groups.append(
|
|
302
|
+
CircuitGroup(
|
|
303
|
+
name=f"{str(self.qubits_array)}_length_{seq_length}",
|
|
304
|
+
circuits=parallel_transpiled_rb_circuits[seq_length],
|
|
305
|
+
)
|
|
306
|
+
)
|
|
301
307
|
qubit_idx = {str(self.qubits_array): "parallel_all"}
|
|
302
308
|
dataset.attrs["parallel_all"] = {"qubits": self.qubits_array}
|
|
303
309
|
dataset.attrs.update({q_idx: {"qubits": q} for q_idx, q in enumerate(self.qubits_array)})
|
|
@@ -347,8 +353,12 @@ class CliffordRandomizedBenchmarking(Benchmark):
|
|
|
347
353
|
f"All jobs for qubits {qubits} and sequence lengths {self.sequence_lengths} submitted successfully!"
|
|
348
354
|
)
|
|
349
355
|
|
|
350
|
-
self.untranspiled_circuits
|
|
351
|
-
|
|
356
|
+
self.untranspiled_circuits.circuit_groups.append(
|
|
357
|
+
CircuitGroup(name=str(qubits), circuits=rb_untranspiled_circuits[str(qubits)])
|
|
358
|
+
)
|
|
359
|
+
self.transpiled_circuits.circuit_groups.append(
|
|
360
|
+
CircuitGroup(name=str(qubits), circuits=rb_transpiled_circuits[str(qubits)])
|
|
361
|
+
)
|
|
352
362
|
|
|
353
363
|
dataset.attrs[qubits_idx] = {"qubits": qubits}
|
|
354
364
|
|
|
@@ -377,9 +387,8 @@ class CliffordRandomizedBenchmarking(Benchmark):
|
|
|
377
387
|
qcvv_logger.info(f"Adding counts of qubits {qubits} and depth {depth} run to the dataset")
|
|
378
388
|
dataset, _ = add_counts_to_dataset(execution_results, identifier, dataset)
|
|
379
389
|
|
|
380
|
-
self.add_all_circuits_to_dataset(dataset)
|
|
381
|
-
|
|
382
390
|
qcvv_logger.info(f"RB experiment concluded !")
|
|
391
|
+
self.circuits = Circuits([self.transpiled_circuits, self.untranspiled_circuits])
|
|
383
392
|
|
|
384
393
|
return dataset
|
|
385
394
|
|
|
@@ -21,7 +21,6 @@ from typing import Any, Dict, List, Literal, Optional, Sequence, Type
|
|
|
21
21
|
|
|
22
22
|
from matplotlib.figure import Figure
|
|
23
23
|
import numpy as np
|
|
24
|
-
from qiskit import QuantumCircuit
|
|
25
24
|
import xarray as xr
|
|
26
25
|
|
|
27
26
|
from iqm.benchmarks.benchmark import BenchmarkConfigurationBase
|
|
@@ -33,6 +32,7 @@ from iqm.benchmarks.benchmark_definition import (
|
|
|
33
32
|
BenchmarkRunResult,
|
|
34
33
|
add_counts_to_dataset,
|
|
35
34
|
)
|
|
35
|
+
from iqm.benchmarks.circuit_containers import BenchmarkCircuit, CircuitGroup, Circuits
|
|
36
36
|
from iqm.benchmarks.logging_config import qcvv_logger
|
|
37
37
|
from iqm.benchmarks.randomized_benchmarking.randomized_benchmarking_common import (
|
|
38
38
|
exponential_rb,
|
|
@@ -50,6 +50,7 @@ from iqm.benchmarks.randomized_benchmarking.randomized_benchmarking_common impor
|
|
|
50
50
|
validate_rb_qubits,
|
|
51
51
|
)
|
|
52
52
|
from iqm.benchmarks.utils import retrieve_all_counts, retrieve_all_job_metadata, timeit, xrvariable_to_counts
|
|
53
|
+
from iqm.qiskit_iqm import IQMCircuit as QuantumCircuit
|
|
53
54
|
from iqm.qiskit_iqm.iqm_backend import IQMBackendBase
|
|
54
55
|
|
|
55
56
|
|
|
@@ -220,13 +221,6 @@ def interleaved_rb_analysis(run: BenchmarkRunResult) -> BenchmarkAnalysisResult:
|
|
|
220
221
|
)
|
|
221
222
|
plots[fig_name] = fig
|
|
222
223
|
|
|
223
|
-
# Rearrange observations
|
|
224
|
-
# observations_refactored: Dict[int, Dict[str, Dict[str, float]]] = {}
|
|
225
|
-
# for k, o in obs_dict.items():
|
|
226
|
-
# observations_refactored[k] = {}
|
|
227
|
-
# for rb_type in o.keys():
|
|
228
|
-
# observations_refactored[k].update({f"{k}_{rb_type}": v for k, v in o[rb_type].items()})
|
|
229
|
-
|
|
230
224
|
return BenchmarkAnalysisResult(dataset=dataset, observations=observations, plots=plots)
|
|
231
225
|
|
|
232
226
|
|
|
@@ -310,9 +304,9 @@ class InterleavedRandomizedBenchmarking(Benchmark):
|
|
|
310
304
|
time_circuit_generation: Dict[str, float] = {}
|
|
311
305
|
|
|
312
306
|
# Initialize the variable to contain the circuits for each layout
|
|
313
|
-
self.untranspiled_circuits: Dict[str, Dict[int, List[QuantumCircuit]]] = {}
|
|
314
|
-
self.transpiled_circuits: Dict[str, Dict[int, List[QuantumCircuit]]] = {}
|
|
315
307
|
|
|
308
|
+
self.untranspiled_circuits = BenchmarkCircuit("untranspiled_circuits")
|
|
309
|
+
self.transpiled_circuits = BenchmarkCircuit("transpiled_circuits")
|
|
316
310
|
# Validate and get interleaved gate as a QC
|
|
317
311
|
interleaved_gate_qc = validate_irb_gate(
|
|
318
312
|
self.interleaved_gate, backend, gate_params=self.interleaved_gate_params
|
|
@@ -407,18 +401,30 @@ class InterleavedRandomizedBenchmarking(Benchmark):
|
|
|
407
401
|
)
|
|
408
402
|
qcvv_logger.info(f"Both jobs for sequence length {seq_length} submitted successfully!")
|
|
409
403
|
|
|
410
|
-
self.untranspiled_circuits
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
self.
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
404
|
+
self.untranspiled_circuits.circuit_groups.append(
|
|
405
|
+
CircuitGroup(
|
|
406
|
+
name=str(self.qubits_array),
|
|
407
|
+
circuits=[parallel_untranspiled_rb_circuits[m] for m in self.sequence_lengths],
|
|
408
|
+
)
|
|
409
|
+
)
|
|
410
|
+
self.transpiled_circuits.circuit_groups.append(
|
|
411
|
+
CircuitGroup(
|
|
412
|
+
name=str(self.qubits_array),
|
|
413
|
+
circuits=[parallel_transpiled_rb_circuits[m] for m in self.sequence_lengths],
|
|
414
|
+
)
|
|
415
|
+
)
|
|
416
|
+
self.untranspiled_circuits.circuit_groups.append(
|
|
417
|
+
CircuitGroup(
|
|
418
|
+
name=f"{str(self.qubits_array)}_interleaved",
|
|
419
|
+
circuits=[parallel_untranspiled_interleaved_rb_circuits[m] for m in self.sequence_lengths],
|
|
420
|
+
)
|
|
421
|
+
)
|
|
422
|
+
self.transpiled_circuits.circuit_groups.append(
|
|
423
|
+
CircuitGroup(
|
|
424
|
+
name=f"{str(self.qubits_array)}_interleaved",
|
|
425
|
+
circuits=[parallel_transpiled_interleaved_rb_circuits[m] for m in self.sequence_lengths],
|
|
426
|
+
)
|
|
427
|
+
)
|
|
422
428
|
|
|
423
429
|
qubit_idx = {str(self.qubits_array): "parallel_all"}
|
|
424
430
|
dataset.attrs["parallel_all"] = {"qubits": self.qubits_array}
|
|
@@ -502,12 +508,25 @@ class InterleavedRandomizedBenchmarking(Benchmark):
|
|
|
502
508
|
f"All jobs for qubits {qubits} and sequence lengths {self.sequence_lengths} submitted successfully!"
|
|
503
509
|
)
|
|
504
510
|
|
|
505
|
-
self.untranspiled_circuits
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
+
self.untranspiled_circuits.circuit_groups.append(
|
|
512
|
+
CircuitGroup(name=str(qubits), circuits=[rb_untranspiled_circuits[str(qubits)]])
|
|
513
|
+
)
|
|
514
|
+
self.transpiled_circuits.circuit_groups.append(
|
|
515
|
+
CircuitGroup(name=str(qubits), circuits=[rb_transpiled_circuits[str(qubits)]])
|
|
516
|
+
)
|
|
517
|
+
|
|
518
|
+
self.untranspiled_circuits.circuit_groups.append(
|
|
519
|
+
CircuitGroup(
|
|
520
|
+
name=f"{str(qubits)}_interleaved", circuits=[rb_untranspiled_interleaved_circuits[str(qubits)]]
|
|
521
|
+
)
|
|
522
|
+
)
|
|
523
|
+
self.transpiled_circuits.circuit_groups.append(
|
|
524
|
+
CircuitGroup(
|
|
525
|
+
name=f"{str(qubits)}_interleaved",
|
|
526
|
+
# name=str(qubits),
|
|
527
|
+
circuits=[rb_transpiled_interleaved_circuits[str(qubits)]],
|
|
528
|
+
)
|
|
529
|
+
)
|
|
511
530
|
|
|
512
531
|
dataset.attrs[qubits_idx] = {"qubits": qubits}
|
|
513
532
|
|
|
@@ -539,9 +558,8 @@ class InterleavedRandomizedBenchmarking(Benchmark):
|
|
|
539
558
|
qcvv_logger.info(f"Adding counts of qubits {qubits} and depth {depth} run to the dataset")
|
|
540
559
|
dataset, _ = add_counts_to_dataset(execution_results, identifier, dataset)
|
|
541
560
|
|
|
542
|
-
self.add_all_circuits_to_dataset(dataset)
|
|
543
|
-
|
|
544
561
|
qcvv_logger.info(f"Interleaved RB experiment concluded !")
|
|
562
|
+
self.circuits = Circuits([self.transpiled_circuits, self.untranspiled_circuits])
|
|
545
563
|
|
|
546
564
|
return dataset
|
|
547
565
|
|
|
@@ -9,7 +9,7 @@ from typing import Any, Dict, List, Optional, Sequence, Tuple, Type, cast
|
|
|
9
9
|
import warnings
|
|
10
10
|
|
|
11
11
|
import numpy as np
|
|
12
|
-
from qiskit import
|
|
12
|
+
from qiskit import transpile
|
|
13
13
|
from qiskit.quantum_info import random_clifford, random_pauli
|
|
14
14
|
from qiskit_aer import Aer
|
|
15
15
|
from scipy.spatial.distance import hamming
|
|
@@ -18,6 +18,7 @@ import xarray as xr
|
|
|
18
18
|
from iqm.benchmarks import BenchmarkAnalysisResult, BenchmarkRunResult
|
|
19
19
|
from iqm.benchmarks.benchmark import BenchmarkConfigurationBase
|
|
20
20
|
from iqm.benchmarks.benchmark_definition import Benchmark, add_counts_to_dataset
|
|
21
|
+
from iqm.benchmarks.circuit_containers import BenchmarkCircuit, CircuitGroup, Circuits
|
|
21
22
|
from iqm.benchmarks.logging_config import qcvv_logger
|
|
22
23
|
from iqm.benchmarks.randomized_benchmarking.randomized_benchmarking_common import (
|
|
23
24
|
exponential_rb,
|
|
@@ -34,6 +35,7 @@ from iqm.benchmarks.utils import (
|
|
|
34
35
|
timeit,
|
|
35
36
|
xrvariable_to_counts,
|
|
36
37
|
)
|
|
38
|
+
from iqm.qiskit_iqm import IQMCircuit as QuantumCircuit
|
|
37
39
|
from iqm.qiskit_iqm.iqm_backend import IQMBackendBase
|
|
38
40
|
|
|
39
41
|
|
|
@@ -443,7 +445,7 @@ def mrb_analysis(run: BenchmarkRunResult) -> BenchmarkAnalysisResult:
|
|
|
443
445
|
else:
|
|
444
446
|
assigned_mrb_depths = {str(qubits_array[i]): [2 * m for m in depths_array[i]] for i in range(len(depths_array))}
|
|
445
447
|
|
|
446
|
-
transpiled_circuits =
|
|
448
|
+
transpiled_circuits = run.circuits["transpiled_circuits"]
|
|
447
449
|
simulator = Aer.get_backend("qasm_simulator")
|
|
448
450
|
|
|
449
451
|
all_noisy_counts: Dict[str, Dict[int, List[Dict[str, int]]]] = {}
|
|
@@ -468,7 +470,7 @@ def mrb_analysis(run: BenchmarkRunResult) -> BenchmarkAnalysisResult:
|
|
|
468
470
|
# Execute the quantum circuits on the simulated, ideal backend
|
|
469
471
|
# pylint: disable=unbalanced-tuple-unpacking
|
|
470
472
|
all_noiseless_jobs, _ = submit_execute(
|
|
471
|
-
{tuple(qubits): transpiled_circuits[str(qubits)
|
|
473
|
+
{tuple(qubits): transpiled_circuits[f"{str(qubits)}_depth_{str(depth)}"].circuits},
|
|
472
474
|
simulator,
|
|
473
475
|
shots,
|
|
474
476
|
calset_id=None,
|
|
@@ -610,23 +612,6 @@ class MirrorRandomizedBenchmarking(Benchmark):
|
|
|
610
612
|
dataset.attrs[key] = value
|
|
611
613
|
# Defined outside configuration - if any
|
|
612
614
|
|
|
613
|
-
@timeit
|
|
614
|
-
def add_all_circuits_to_dataset(self, dataset: xr.Dataset):
|
|
615
|
-
"""Adds all generated circuits during execution to the dataset variable
|
|
616
|
-
Args:
|
|
617
|
-
dataset (xr.Dataset): The xarray dataset
|
|
618
|
-
"""
|
|
619
|
-
qcvv_logger.info(f"Adding all circuits to the dataset")
|
|
620
|
-
for key, circuit in zip(
|
|
621
|
-
["transpiled_circuits", "untranspiled_circuits"], [self.transpiled_circuits, self.untranspiled_circuits]
|
|
622
|
-
):
|
|
623
|
-
dictionary = {}
|
|
624
|
-
for outer_key, outer_value in circuit.items():
|
|
625
|
-
dictionary[str(outer_key)] = {
|
|
626
|
-
str(inner_key): inner_values for inner_key, inner_values in outer_value.items()
|
|
627
|
-
}
|
|
628
|
-
dataset.attrs[key] = dictionary
|
|
629
|
-
|
|
630
615
|
def submit_single_mrb_job(
|
|
631
616
|
self,
|
|
632
617
|
backend_arg: IQMBackendBase,
|
|
@@ -674,8 +659,8 @@ class MirrorRandomizedBenchmarking(Benchmark):
|
|
|
674
659
|
time_circuit_generation: Dict[str, float] = {}
|
|
675
660
|
|
|
676
661
|
# Initialize the variable to contain the circuits for each layout
|
|
677
|
-
self.untranspiled_circuits
|
|
678
|
-
self.transpiled_circuits
|
|
662
|
+
self.untranspiled_circuits = BenchmarkCircuit("untranspiled_circuits")
|
|
663
|
+
self.transpiled_circuits = BenchmarkCircuit("transpiled_circuits")
|
|
679
664
|
|
|
680
665
|
# The depths should be assigned to each set of qubits!
|
|
681
666
|
# The real final MRB depths are twice the originally specified, must be taken into account here!
|
|
@@ -699,8 +684,6 @@ class MirrorRandomizedBenchmarking(Benchmark):
|
|
|
699
684
|
qubit_idx: Dict[str, Any] = {}
|
|
700
685
|
for qubits_idx, qubits in enumerate(self.qubits_array):
|
|
701
686
|
qubit_idx[str(qubits)] = qubits_idx
|
|
702
|
-
self.untranspiled_circuits[str(qubits)] = {}
|
|
703
|
-
self.transpiled_circuits[str(qubits)] = {}
|
|
704
687
|
|
|
705
688
|
qcvv_logger.info(
|
|
706
689
|
f"Executing MRB on qubits {qubits}."
|
|
@@ -739,12 +722,12 @@ class MirrorRandomizedBenchmarking(Benchmark):
|
|
|
739
722
|
all_mrb_jobs.append(self.submit_single_mrb_job(backend, qubits, depth, sorted_transpiled_qc_list))
|
|
740
723
|
qcvv_logger.info(f"Job for layout {qubits} & depth {depth} submitted successfully!")
|
|
741
724
|
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
725
|
+
self.untranspiled_circuits.circuit_groups.append(
|
|
726
|
+
CircuitGroup(name=f"{str(qubits)}_depth_{depth}", circuits=mrb_untranspiled_circuits_lists[depth])
|
|
727
|
+
)
|
|
728
|
+
self.transpiled_circuits.circuit_groups.append(
|
|
729
|
+
CircuitGroup(name=f"{str(qubits)}_depth_{depth}", circuits=mrb_transpiled_circuits_lists[depth])
|
|
730
|
+
)
|
|
748
731
|
|
|
749
732
|
dataset.attrs[qubits_idx] = {"qubits": qubits}
|
|
750
733
|
|
|
@@ -774,7 +757,7 @@ class MirrorRandomizedBenchmarking(Benchmark):
|
|
|
774
757
|
qcvv_logger.info(f"Adding counts of qubits {qubits} and depth {depth} run to the dataset")
|
|
775
758
|
dataset, _ = add_counts_to_dataset(execution_results, f"qubits_{str(qubits)}_depth_{str(depth)}", dataset)
|
|
776
759
|
|
|
777
|
-
self.
|
|
760
|
+
self.circuits = Circuits([self.transpiled_circuits, self.untranspiled_circuits])
|
|
778
761
|
|
|
779
762
|
qcvv_logger.info(f"MRB experiment execution concluded !")
|
|
780
763
|
|
|
@@ -29,13 +29,14 @@ from matplotlib.collections import PolyCollection
|
|
|
29
29
|
from matplotlib.figure import Figure
|
|
30
30
|
import matplotlib.pyplot as plt
|
|
31
31
|
import numpy as np
|
|
32
|
-
from qiskit import
|
|
32
|
+
from qiskit import transpile
|
|
33
33
|
from qiskit.quantum_info import Clifford
|
|
34
34
|
import xarray as xr
|
|
35
35
|
|
|
36
36
|
from iqm.benchmarks.logging_config import qcvv_logger
|
|
37
37
|
from iqm.benchmarks.randomized_benchmarking.multi_lmfit import create_multi_dataset_params, multi_dataset_residual
|
|
38
38
|
from iqm.benchmarks.utils import get_iqm_backend, marginal_distribution, submit_execute, timeit
|
|
39
|
+
from iqm.qiskit_iqm import IQMCircuit as QuantumCircuit
|
|
39
40
|
from iqm.qiskit_iqm import optimize_single_qubit_gates
|
|
40
41
|
from iqm.qiskit_iqm.iqm_backend import IQMBackendBase
|
|
41
42
|
|
|
@@ -550,7 +551,7 @@ def plot_rb_decay(
|
|
|
550
551
|
shade_stdev (bool, optional): Whether standard deviations are shaded or not. Defaults to False
|
|
551
552
|
shade_meanerror (bool, optional): Whether to shade standard deviations. Defaults to False
|
|
552
553
|
logscale (bool, optional): Whether x-axis uses logscale. Defaults to True
|
|
553
|
-
interleaved_gate (Optional[str]):
|
|
554
|
+
interleaved_gate (Optional[str]): The label or the interleaved gate. Defaults to None
|
|
554
555
|
mrb_2q_density (Optional[float], optional): Density of MRB 2Q gates. Defaults to None.
|
|
555
556
|
mrb_2q_ensemble (Optional[Dict[str, float]], optional): MRB ensemble of 2Q gates. Defaults to None.
|
|
556
557
|
|
|
@@ -771,7 +772,7 @@ def plot_rb_decay(
|
|
|
771
772
|
if identifier == "mrb":
|
|
772
773
|
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} (%)"
|
|
773
774
|
elif key == "interleaved":
|
|
774
|
-
plot_label = fr"$\overline{{F}}_{{interleaved_gate}} ({qubits})$ = {100.0 * fidelity_value[key][str(qubits)]:.2f} +/- {100.0 * fidelity_stderr[key][str(qubits)]:.2f} (%)"
|
|
775
|
+
plot_label = fr"$\overline{{F}}_{{{interleaved_gate}}} ({qubits})$ = {100.0 * fidelity_value[key][str(qubits)]:.2f} +/- {100.0 * fidelity_stderr[key][str(qubits)]:.2f} (%)"
|
|
775
776
|
else:
|
|
776
777
|
print(fidelity_value)
|
|
777
778
|
print(qubits)
|
|
@@ -25,10 +25,11 @@ from mthree.classes import QuasiCollection
|
|
|
25
25
|
from mthree.exceptions import M3Error
|
|
26
26
|
from mthree.mitigation import _job_thread
|
|
27
27
|
from mthree.utils import final_measurement_mapping
|
|
28
|
-
from qiskit import
|
|
28
|
+
from qiskit import transpile # pylint: disable = no-name-in-module
|
|
29
29
|
from qiskit.providers import Backend, BackendV1, BackendV2
|
|
30
30
|
|
|
31
31
|
from iqm.benchmarks.utils import get_iqm_backend, timeit
|
|
32
|
+
from iqm.qiskit_iqm import IQMCircuit as QuantumCircuit
|
|
32
33
|
from iqm.qiskit_iqm.iqm_backend import IQMBackendBase
|
|
33
34
|
|
|
34
35
|
|
iqm/benchmarks/utils.py
CHANGED
|
@@ -25,12 +25,13 @@ from typing import Any, Dict, Iterable, List, Literal, Optional, Sequence, Tuple
|
|
|
25
25
|
from more_itertools import chunked
|
|
26
26
|
from mthree.utils import final_measurement_mapping
|
|
27
27
|
import numpy as np
|
|
28
|
-
from qiskit import ClassicalRegister,
|
|
28
|
+
from qiskit import ClassicalRegister, transpile
|
|
29
29
|
from qiskit.converters import circuit_to_dag
|
|
30
30
|
from qiskit.transpiler import CouplingMap
|
|
31
31
|
import xarray as xr
|
|
32
32
|
|
|
33
33
|
from iqm.benchmarks.logging_config import qcvv_logger
|
|
34
|
+
from iqm.qiskit_iqm import IQMCircuit as QuantumCircuit
|
|
34
35
|
from iqm.qiskit_iqm import transpile_to_IQM
|
|
35
36
|
from iqm.qiskit_iqm.fake_backends.fake_adonis import IQMFakeAdonis
|
|
36
37
|
from iqm.qiskit_iqm.fake_backends.fake_apollo import IQMFakeApollo
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: iqm-benchmarks
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0
|
|
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>
|
|
6
6
|
Project-URL: Homepage, https://github.com/iqm-finland/iqm-benchmarks
|
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
iqm/benchmarks/__init__.py,sha256=
|
|
1
|
+
iqm/benchmarks/__init__.py,sha256=sAS6OKctANSzgVUEUWugQs9mcKwG9KOTBEsbSYGxtPc,2201
|
|
2
2
|
iqm/benchmarks/benchmark.py,sha256=SGhBcSxLPUu-cVXAjG4Db2TRobFCRBYoE1NtTDK1lJg,4432
|
|
3
|
-
iqm/benchmarks/benchmark_definition.py,sha256=
|
|
4
|
-
iqm/benchmarks/benchmark_experiment.py,sha256=
|
|
3
|
+
iqm/benchmarks/benchmark_definition.py,sha256=AZkvANrf0_0glbq_P_uo_YqbBU9IZa2gJlMVz6qT6VU,10500
|
|
4
|
+
iqm/benchmarks/benchmark_experiment.py,sha256=ynbsQS92v6soIgkDEdm3ygNO7f82-dhg7qB1l8jvSFM,6614
|
|
5
|
+
iqm/benchmarks/circuit_containers.py,sha256=anEtZEsodYqOX-34oZRmuKGeEpp_VfgG5045Mz4-4hI,7562
|
|
5
6
|
iqm/benchmarks/logging_config.py,sha256=U7olP5Kr75AcLJqNODf9VBhJLVqIvA4AYR6J39D5rww,1052
|
|
6
|
-
iqm/benchmarks/readout_mitigation.py,sha256=
|
|
7
|
-
iqm/benchmarks/utils.py,sha256=
|
|
7
|
+
iqm/benchmarks/readout_mitigation.py,sha256=6lWtDyc0-3WMtVrlwsbC60Ba_xaCDblzdKc34nBbPXg,12327
|
|
8
|
+
iqm/benchmarks/utils.py,sha256=BNbPeNNiFfE72Y-coVjLK3O7y7-j1Ag-l_qyBQsxXRY,20278
|
|
8
9
|
iqm/benchmarks/compressive_gst/__init__.py,sha256=4F_5YxExn4ysGQaEs-WNfm0yiFBxkKtGAYBZFWnRsSk,915
|
|
9
|
-
iqm/benchmarks/compressive_gst/compressive_gst.py,sha256=
|
|
10
|
+
iqm/benchmarks/compressive_gst/compressive_gst.py,sha256=pzkqFQQXEZZJmQgwyLo2_eF3rcK3BwXAj5QfY4poczY,21206
|
|
10
11
|
iqm/benchmarks/compressive_gst/gst_analysis.py,sha256=qaF9zDIadPGe9I0l_SC3EfnODZiykzVRxdl4Pu9zZAY,34813
|
|
11
12
|
iqm/benchmarks/entanglement/__init__.py,sha256=9T7prOwqMmFWdb4t6ETAHZXKK5o6FvU2DvVb6WhNi-U,682
|
|
12
|
-
iqm/benchmarks/entanglement/ghz.py,sha256=
|
|
13
|
+
iqm/benchmarks/entanglement/ghz.py,sha256=qg6mw1RydosKdc2KoPi6M3q0Ek7eMBPIkWOJC2ZDx8M,39446
|
|
13
14
|
iqm/benchmarks/optimization/__init__.py,sha256=_ajW_OibYLCtzU5AUv5c2zuuVYn8ZNeZUcUUSIGt51M,747
|
|
14
|
-
iqm/benchmarks/optimization/qscore.py,sha256=
|
|
15
|
+
iqm/benchmarks/optimization/qscore.py,sha256=pTDRrNI2kkujqb5IoaPTiq9MS8OZd9M8Gv0G2Jn3Ka0,28078
|
|
15
16
|
iqm/benchmarks/quantum_volume/__init__.py,sha256=i-Q4SpDWELBw7frXnxm1j4wJRcxbIyrS5uEK_v06YHo,951
|
|
16
|
-
iqm/benchmarks/quantum_volume/clops.py,sha256=
|
|
17
|
-
iqm/benchmarks/quantum_volume/quantum_volume.py,sha256=
|
|
17
|
+
iqm/benchmarks/quantum_volume/clops.py,sha256=j6BPEj1rKBAHigox7nrvaTLyb4iCrHadBl2d1yiETDA,30956
|
|
18
|
+
iqm/benchmarks/quantum_volume/quantum_volume.py,sha256=8UHDyw1aVXnmo9DpK_qGcfa_NLS148a2YdYNDS4NE78,36870
|
|
18
19
|
iqm/benchmarks/randomized_benchmarking/__init__.py,sha256=IkKo-7zUChxZZd3my_csQCJfJfZNsV3-JTvdG8uqys4,734
|
|
19
20
|
iqm/benchmarks/randomized_benchmarking/clifford_1q.pkl,sha256=vvSd0pRWxtzyirohO9yf_58mjevkc2-pbuWIEb-4gaw,46928
|
|
20
21
|
iqm/benchmarks/randomized_benchmarking/clifford_2q.pkl,sha256=ZipqU3crPhz2T35qGFgB4GvMyoi_7pnu8NqW5ZP8NXg,90707258
|
|
21
22
|
iqm/benchmarks/randomized_benchmarking/multi_lmfit.py,sha256=Se1ygR4mXn_2_P82Ch31KBnCmY-g_A9NKzE9Ir8nEvw,3247
|
|
22
|
-
iqm/benchmarks/randomized_benchmarking/randomized_benchmarking_common.py,sha256=
|
|
23
|
+
iqm/benchmarks/randomized_benchmarking/randomized_benchmarking_common.py,sha256=f3llbTm7RAYAiYCATXY6RnNPaoN5toVpRQF2RDsSG1c,37986
|
|
23
24
|
iqm/benchmarks/randomized_benchmarking/clifford_rb/__init__.py,sha256=bTDA156LAl7OLGcMec--1nzDrV1XpPRVq3CquTmucgE,677
|
|
24
|
-
iqm/benchmarks/randomized_benchmarking/clifford_rb/clifford_rb.py,sha256=
|
|
25
|
+
iqm/benchmarks/randomized_benchmarking/clifford_rb/clifford_rb.py,sha256=q8bHcrVr8EjTuLeOdg3RoeoLaZhmieCd09IvH-tSvYs,18038
|
|
25
26
|
iqm/benchmarks/randomized_benchmarking/interleaved_rb/__init__.py,sha256=sq6MgN_hwlpkOj10vyCU4e6eKSX-oLcF2L9na6W2Gt4,681
|
|
26
|
-
iqm/benchmarks/randomized_benchmarking/interleaved_rb/interleaved_rb.py,sha256=
|
|
27
|
+
iqm/benchmarks/randomized_benchmarking/interleaved_rb/interleaved_rb.py,sha256=PlHn1J8VPaJF5csNH8jxcifz_MdisOEPU54kU-FYoLY,26920
|
|
27
28
|
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=
|
|
29
|
+
iqm/benchmarks/randomized_benchmarking/mirror_rb/mirror_rb.py,sha256=kYlcH0uFdFZmZhkPPEliUTftfDTpefjFdlTgDDo_NXM,33819
|
|
29
30
|
mGST/LICENSE,sha256=TtHNq55cUcbglb7uhVudeBLUh_qPdUoAEvU0BBwFz-k,1098
|
|
30
31
|
mGST/README.md,sha256=v_5kw253csHF4-RfE-44KqFmBXIsSMRmOtN0AUPrRxE,5050
|
|
31
32
|
mGST/additional_fns.py,sha256=_SEJ10FRNM7_CroysT8hCLZTfpm6ZhEIDCY5zPTnhjo,31390
|
|
@@ -33,11 +34,11 @@ mGST/algorithm.py,sha256=jSB9G9uI30zD-IZBJvrvIbdPMXp0elXPxk8F8QeyC3w,26006
|
|
|
33
34
|
mGST/compatibility.py,sha256=00DsPnNfOtrQcDTvxBDs-0aMhmuXmOIIxl_Ohy-Emkg,8920
|
|
34
35
|
mGST/low_level_jit.py,sha256=z6taafZOmgIRsnKZKPFN6aJ2daRsVjzOeOk_GtmcdwI,27023
|
|
35
36
|
mGST/optimization.py,sha256=YHwkzIkYvsZOPjclR-BCQWh24jeqjuXp0BB0WX5Lwow,10559
|
|
36
|
-
mGST/qiskit_interface.py,sha256=
|
|
37
|
+
mGST/qiskit_interface.py,sha256=L4H-4SdhP_bjSFFvpQoF1E7EyGbIJ_CI_y4a7_YEwmU,10102
|
|
37
38
|
mGST/reporting/figure_gen.py,sha256=6Xd8vwfy09hLY1YbJY6TRevuMsQSU4MsWqemly3ZO0I,12970
|
|
38
39
|
mGST/reporting/reporting.py,sha256=-XBy3OCJIMOsA8cApwKjhVKBwnjSAoxm-voHNbRWytM,25803
|
|
39
|
-
iqm_benchmarks-
|
|
40
|
-
iqm_benchmarks-
|
|
41
|
-
iqm_benchmarks-
|
|
42
|
-
iqm_benchmarks-
|
|
43
|
-
iqm_benchmarks-
|
|
40
|
+
iqm_benchmarks-2.0.dist-info/LICENSE,sha256=2Ncb40-hqkTil78RPv3-YiJfKaJ8te9USJgliKqIdSY,11558
|
|
41
|
+
iqm_benchmarks-2.0.dist-info/METADATA,sha256=moUhKnA-8gK-xTCG6on6lmkJbKRpeVOR_6FS0c3HjSI,9073
|
|
42
|
+
iqm_benchmarks-2.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
43
|
+
iqm_benchmarks-2.0.dist-info/top_level.txt,sha256=3G23Z-1LGf-IOzTCUl6QwWqiQ3USz25Zt90Ihq192to,9
|
|
44
|
+
iqm_benchmarks-2.0.dist-info/RECORD,,
|
mGST/qiskit_interface.py
CHANGED
|
@@ -5,10 +5,10 @@ Bridge between mGST and Qiskit
|
|
|
5
5
|
import random
|
|
6
6
|
|
|
7
7
|
import numpy as np
|
|
8
|
-
from qiskit import QuantumCircuit
|
|
9
8
|
from qiskit.circuit.library import IGate
|
|
10
9
|
from qiskit.quantum_info import Operator
|
|
11
10
|
|
|
11
|
+
from iqm.qiskit_iqm import IQMCircuit as QuantumCircuit
|
|
12
12
|
from mGST import additional_fns, algorithm, low_level_jit
|
|
13
13
|
from mGST.compatibility import arrays_to_pygsti_model
|
|
14
14
|
from mGST.reporting.reporting import gauge_opt, quick_report
|
|
File without changes
|
|
File without changes
|
|
File without changes
|