iqm-benchmarks 2.20__py3-none-any.whl → 2.21__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.

@@ -682,7 +682,7 @@ class GHZBenchmark(Benchmark):
682
682
  )
683
683
  final_ghz = ghz_native_transpiled
684
684
  elif routine == "star":
685
- ghz: QuantumCircuit = generate_ghz_star(qubit_count)
685
+ ghz = generate_ghz_star(qubit_count)
686
686
  circuit_group.add_circuit(ghz)
687
687
  ghz_native_transpiled, _ = perform_backend_transpilation(
688
688
  [ghz],
@@ -25,7 +25,7 @@ from mthree.exceptions import M3Error
25
25
  from mthree.mitigation import _job_thread
26
26
  from mthree.utils import final_measurement_mapping
27
27
  from qiskit import transpile # pylint: disable = no-name-in-module
28
- from qiskit.providers import Backend, BackendV1, BackendV2
28
+ from qiskit.providers import BackendV1, BackendV2
29
29
 
30
30
  from iqm.benchmarks.logging_config import qcvv_logger
31
31
  from iqm.benchmarks.utils import get_iqm_backend, timeit
iqm/benchmarks/utils.py CHANGED
@@ -25,6 +25,7 @@ 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 numpy.random import Generator
28
29
  from qiskit import ClassicalRegister, transpile
29
30
  from qiskit.converters import circuit_to_dag
30
31
  from qiskit.transpiler import CouplingMap
@@ -65,6 +66,54 @@ def timeit(f):
65
66
  return wrap
66
67
 
67
68
 
69
+ def bootstrap_counts(
70
+ original_counts: Dict[str, int],
71
+ num_bootstrap_samples: int = 100,
72
+ rgen: Optional[Generator] = None,
73
+ include_original_counts: bool = False,
74
+ ) -> List[Dict[str, int]]:
75
+ """Returns num_bootstrap_samples resampled copies of the original_counts.
76
+
77
+ Args:
78
+ original_counts (Dict[str, int]): The original dictionary of counts to bootstrap from.
79
+ num_bootstrap_samples (int): The number of bootstrapping samples to generate.
80
+ * Default is 100.
81
+ rgen (Optional[Generator]): The random number generator.
82
+ * Default is None: assigns numpy's default_rng().
83
+ include_original_counts (bool): Whether to include the original counts in the returned bootstrapped count samples.
84
+ * Default is False.
85
+ Returns:
86
+ List[Dict[str, int]]: A list of bootstrapped counts.
87
+ """
88
+ if rgen is None:
89
+ rgen = np.random.default_rng()
90
+
91
+ keys = list(original_counts.keys())
92
+ values = list(original_counts.values())
93
+ tot_shots = int(sum(values))
94
+
95
+ # Pre-calculate cumulative sum and create bins
96
+ cumulative_sum = np.cumsum(values)
97
+ bins = np.insert(cumulative_sum, 0, 0)
98
+
99
+ if include_original_counts:
100
+ bs_counts_fast = [original_counts]
101
+ else:
102
+ bs_counts_fast = []
103
+
104
+ for _ in range(num_bootstrap_samples):
105
+ # Generate random integers
106
+ random_integers = rgen.integers(low=0, high=tot_shots, size=tot_shots)
107
+ # Bin the random integers
108
+ binned_integers = np.digitize(random_integers, bins) - 1
109
+ # Count occurrences in each bin
110
+ occurrences = np.bincount(binned_integers, minlength=len(keys))
111
+ # Create dictionary mapping keys to occurrence counts
112
+ bs_counts_fast.append(dict(zip(keys, occurrences)))
113
+
114
+ return bs_counts_fast
115
+
116
+
68
117
  @timeit
69
118
  def count_2q_layers(circuit_list: List[QuantumCircuit]) -> List[int]:
70
119
  """Calculate the number of layers of parallel 2-qubit gates in a list of circuits.
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: iqm-benchmarks
3
- Version: 2.20
3
+ Version: 2.21
4
4
  Summary: A package for implementation of Quantum Characterization, Verification and Validation (QCVV) techniques on IQM's hardware at gate level abstraction
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>, Adrian Auer <adrian.auer@meetiqm.com>, Nadia Milazzo <nadia.milazzo@meetiqm.com>
5
+ Author-email: IQM Finland Oy <developers@meetiqm.com>, Adrian Auer <adrian.auer@meetiqm.com>, Raphael Brieger <raphael.brieger@meetiqm.com>, Alessio Calzona <alessio.calzona@meetiqm.com>, Pedro Figueroa Romero <pedro.romero@meetiqm.com>, Amin Hosseinkhani <amin.hosseinkhani@meetiqm.com>, Miikka Koistinen <miikka@meetiqm.com>, Nadia Milazzo <nadia.milazzo@meetiqm.com>, Vicente Pina Canelles <vicente.pina@meetiqm.com>, Aniket Rath <aniket.rath@meetiqm.com>, Jami Rönkkö <jami@meetiqm.com>, Stefan Seegerer <stefan.seegerer@meetiqm.com>
6
6
  Project-URL: Homepage, https://github.com/iqm-finland/iqm-benchmarks
7
7
  Classifier: Development Status :: 4 - Beta
8
8
  Classifier: Programming Language :: Python :: 3 :: Only
@@ -3,13 +3,13 @@ iqm/benchmarks/benchmark.py,sha256=SGhBcSxLPUu-cVXAjG4Db2TRobFCRBYoE1NtTDK1lJg,4
3
3
  iqm/benchmarks/benchmark_definition.py,sha256=AZkvANrf0_0glbq_P_uo_YqbBU9IZa2gJlMVz6qT6VU,10500
4
4
  iqm/benchmarks/circuit_containers.py,sha256=anEtZEsodYqOX-34oZRmuKGeEpp_VfgG5045Mz4-4hI,7562
5
5
  iqm/benchmarks/logging_config.py,sha256=U7olP5Kr75AcLJqNODf9VBhJLVqIvA4AYR6J39D5rww,1052
6
- iqm/benchmarks/readout_mitigation.py,sha256=HLRka3LAlOiH0XdsQCAXmU1K8QVAbG29O_WJj1qv1Dg,11765
7
- iqm/benchmarks/utils.py,sha256=wOgf8x1Z-DsVUL5KQSaKXjGDXDBSvhmwg4Qo-vTOoo0,21172
6
+ iqm/benchmarks/readout_mitigation.py,sha256=Q2SOGWTNgmklOYkNxepAaSaXlxSj0QQyymYY1bOkT8A,11756
7
+ iqm/benchmarks/utils.py,sha256=B3dusTNC4n0gW3KZSaQA6ZZeGok3ABtte-N3JEXCtN0,23022
8
8
  iqm/benchmarks/compressive_gst/__init__.py,sha256=LneifgYXtcwo2jcXo7GdUEHL6_peipukShhkrdaTRCA,929
9
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=0C3zppwGGn_gIkxRWkV_mYqpkygZsu1Ap-xV9PcN0wY,42668
12
+ iqm/benchmarks/entanglement/ghz.py,sha256=tQXKiav6pKZlV3ZU4BOrYrP7PfBAGn0zOsSUORQn5kw,42652
13
13
  iqm/benchmarks/optimization/__init__.py,sha256=_ajW_OibYLCtzU5AUv5c2zuuVYn8ZNeZUcUUSIGt51M,747
14
14
  iqm/benchmarks/optimization/qscore.py,sha256=xAv97MRVUNB_YjRbxzM6Ph0Pz0ctJjSA46J9lrbwe-w,37541
15
15
  iqm/benchmarks/quantum_volume/__init__.py,sha256=i-Q4SpDWELBw7frXnxm1j4wJRcxbIyrS5uEK_v06YHo,951
@@ -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.20.dist-info/LICENSE,sha256=2Ncb40-hqkTil78RPv3-YiJfKaJ8te9USJgliKqIdSY,11558
40
- iqm_benchmarks-2.20.dist-info/METADATA,sha256=HhQLzBlngrxoF65yMzVD9QLeM7tDu739f6UzPgFuxDw,10286
41
- iqm_benchmarks-2.20.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
42
- iqm_benchmarks-2.20.dist-info/top_level.txt,sha256=3G23Z-1LGf-IOzTCUl6QwWqiQ3USz25Zt90Ihq192to,9
43
- iqm_benchmarks-2.20.dist-info/RECORD,,
39
+ iqm_benchmarks-2.21.dist-info/LICENSE,sha256=2Ncb40-hqkTil78RPv3-YiJfKaJ8te9USJgliKqIdSY,11558
40
+ iqm_benchmarks-2.21.dist-info/METADATA,sha256=y-gRyH1c_MMl0hDu-Kv6d_yL78We2Ksctl3UkKc_7tE,10384
41
+ iqm_benchmarks-2.21.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
42
+ iqm_benchmarks-2.21.dist-info/top_level.txt,sha256=3G23Z-1LGf-IOzTCUl6QwWqiQ3USz25Zt90Ihq192to,9
43
+ iqm_benchmarks-2.21.dist-info/RECORD,,