iqm-benchmarks 2.14__py3-none-any.whl → 2.16__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/entanglement/ghz.py +37 -3
- iqm/benchmarks/optimization/qscore.py +41 -13
- iqm/benchmarks/utils.py +1 -1
- {iqm_benchmarks-2.14.dist-info → iqm_benchmarks-2.16.dist-info}/METADATA +2 -2
- {iqm_benchmarks-2.14.dist-info → iqm_benchmarks-2.16.dist-info}/RECORD +8 -8
- {iqm_benchmarks-2.14.dist-info → iqm_benchmarks-2.16.dist-info}/LICENSE +0 -0
- {iqm_benchmarks-2.14.dist-info → iqm_benchmarks-2.16.dist-info}/WHEEL +0 -0
- {iqm_benchmarks-2.14.dist-info → iqm_benchmarks-2.16.dist-info}/top_level.txt +0 -0
|
@@ -267,7 +267,7 @@ def generate_ghz_linear(num_qubits: int) -> QuantumCircuit:
|
|
|
267
267
|
num_qubits: the number of qubits of the GHZ state
|
|
268
268
|
|
|
269
269
|
Returns:
|
|
270
|
-
A quantum circuit generating a GHZ state of
|
|
270
|
+
QuantumCircuit: A quantum circuit generating a GHZ state on a given number of qubits.
|
|
271
271
|
"""
|
|
272
272
|
s = int(num_qubits / 2)
|
|
273
273
|
quantum_register = QuantumRegister(num_qubits)
|
|
@@ -290,7 +290,7 @@ def generate_ghz_log_cruz(num_qubits: int) -> QuantumCircuit:
|
|
|
290
290
|
num_qubits: the number of qubits of the GHZ state
|
|
291
291
|
|
|
292
292
|
Returns:
|
|
293
|
-
A quantum circuit generating a GHZ state of
|
|
293
|
+
QuantumCircuit: A quantum circuit generating a GHZ state on a given number of qubits.
|
|
294
294
|
"""
|
|
295
295
|
quantum_register = QuantumRegister(num_qubits)
|
|
296
296
|
qc = QuantumCircuit(quantum_register, name="GHZ_log_Cruz")
|
|
@@ -305,6 +305,24 @@ def generate_ghz_log_cruz(num_qubits: int) -> QuantumCircuit:
|
|
|
305
305
|
return qc
|
|
306
306
|
|
|
307
307
|
|
|
308
|
+
def generate_ghz_star(num_qubits: int) -> QuantumCircuit:
|
|
309
|
+
"""
|
|
310
|
+
Generates the circuit for creating a GHZ state by maximizing the number of CZ gates between a pair of MOVE gates.
|
|
311
|
+
Args:
|
|
312
|
+
num_qubits: the number of qubits of the GHZ state
|
|
313
|
+
|
|
314
|
+
Returns:
|
|
315
|
+
QuantumCircuit: A quantum circuit generating a GHZ state on a given number of qubits.
|
|
316
|
+
"""
|
|
317
|
+
quantum_register = QuantumRegister(num_qubits)
|
|
318
|
+
qc = QuantumCircuit(quantum_register, name="GHZ_star")
|
|
319
|
+
qc.h(0)
|
|
320
|
+
for i in range(num_qubits - 1):
|
|
321
|
+
qc.cx(0, i + 1)
|
|
322
|
+
qc.measure_all()
|
|
323
|
+
return qc
|
|
324
|
+
|
|
325
|
+
|
|
308
326
|
def generate_ghz_log_mooney(num_qubits: int) -> QuantumCircuit:
|
|
309
327
|
"""
|
|
310
328
|
Generates a GHZ state in log-depth according to https://arxiv.org/abs/2101.08946
|
|
@@ -312,7 +330,7 @@ def generate_ghz_log_mooney(num_qubits: int) -> QuantumCircuit:
|
|
|
312
330
|
num_qubits: the number of qubits of the GHZ state
|
|
313
331
|
|
|
314
332
|
Returns:
|
|
315
|
-
A quantum circuit generating a GHZ state of
|
|
333
|
+
QuantumCircuit: A quantum circuit generating a GHZ state on a given number of qubits.
|
|
316
334
|
"""
|
|
317
335
|
quantum_register = QuantumRegister(num_qubits)
|
|
318
336
|
qc = QuantumCircuit(quantum_register, name="GHZ_log_Mooney")
|
|
@@ -641,6 +659,9 @@ class GHZBenchmark(Benchmark):
|
|
|
641
659
|
elif routine == "tree":
|
|
642
660
|
# For star architectures, create an effective coupling map that represents all-to-all connectivity
|
|
643
661
|
if "move" in self.backend.operation_names:
|
|
662
|
+
qcvv_logger.warning(
|
|
663
|
+
f"The current backend is a star architecture for which a suboptimal state generation routine is chosen. Consider setting state_generation_routine={routine}."
|
|
664
|
+
)
|
|
644
665
|
effective_coupling_map = [[x, y] for x in qubit_layout for y in qubit_layout if x != y]
|
|
645
666
|
else:
|
|
646
667
|
effective_coupling_map = self.backend.coupling_map
|
|
@@ -660,6 +681,19 @@ class GHZBenchmark(Benchmark):
|
|
|
660
681
|
optimize_sqg=self.optimize_sqg,
|
|
661
682
|
)
|
|
662
683
|
final_ghz = ghz_native_transpiled
|
|
684
|
+
elif routine == "star":
|
|
685
|
+
ghz: QuantumCircuit = generate_ghz_star(qubit_count)
|
|
686
|
+
circuit_group.add_circuit(ghz)
|
|
687
|
+
ghz_native_transpiled, _ = perform_backend_transpilation(
|
|
688
|
+
[ghz],
|
|
689
|
+
self.backend,
|
|
690
|
+
qubit_layout,
|
|
691
|
+
fixed_coupling_map,
|
|
692
|
+
qiskit_optim_level=self.qiskit_optim_level,
|
|
693
|
+
optimize_sqg=self.optimize_sqg,
|
|
694
|
+
)
|
|
695
|
+
final_ghz = ghz_native_transpiled
|
|
696
|
+
|
|
663
697
|
else:
|
|
664
698
|
ghz_log = [generate_ghz_log_cruz(qubit_count), generate_ghz_log_mooney(qubit_count)]
|
|
665
699
|
ghz_native_transpiled, _ = perform_backend_transpilation(
|
|
@@ -27,6 +27,7 @@ from iqm.benchmarks.benchmark_definition import (
|
|
|
27
27
|
)
|
|
28
28
|
from iqm.benchmarks.circuit_containers import BenchmarkCircuit, CircuitGroup, Circuits
|
|
29
29
|
from iqm.benchmarks.logging_config import qcvv_logger
|
|
30
|
+
from iqm.benchmarks.readout_mitigation import apply_readout_error_mitigation
|
|
30
31
|
from iqm.benchmarks.utils import ( # execute_with_dd,
|
|
31
32
|
perform_backend_transpilation,
|
|
32
33
|
retrieve_all_counts,
|
|
@@ -479,7 +480,7 @@ def qscore_analysis(run: BenchmarkRunResult) -> BenchmarkAnalysisResult:
|
|
|
479
480
|
observations.extend(
|
|
480
481
|
[
|
|
481
482
|
BenchmarkObservation(
|
|
482
|
-
name="
|
|
483
|
+
name="mean_approximation_ratio",
|
|
483
484
|
value=approximation_ratio,
|
|
484
485
|
uncertainty=std_of_approximation_ratio,
|
|
485
486
|
identifier=BenchmarkObservationIdentifier(num_nodes),
|
|
@@ -596,6 +597,8 @@ class QScoreBenchmark(Benchmark):
|
|
|
596
597
|
self.choose_qubits_routine = configuration.choose_qubits_routine
|
|
597
598
|
self.qiskit_optim_level = configuration.qiskit_optim_level
|
|
598
599
|
self.optimize_sqg = configuration.optimize_sqg
|
|
600
|
+
self.REM = configuration.REM
|
|
601
|
+
self.mit_shots = configuration.mit_shots
|
|
599
602
|
self.session_timestamp = strftime("%Y%m%d-%H%M%S")
|
|
600
603
|
self.execution_timestamp = ""
|
|
601
604
|
self.seed = configuration.seed
|
|
@@ -744,7 +747,7 @@ class QScoreBenchmark(Benchmark):
|
|
|
744
747
|
dataset = xr.Dataset()
|
|
745
748
|
self.add_all_meta_to_dataset(dataset)
|
|
746
749
|
|
|
747
|
-
if self.max_num_nodes is None:
|
|
750
|
+
if self.max_num_nodes is None or self.max_num_nodes == self.backend.num_qubits + 1:
|
|
748
751
|
if self.use_virtual_node:
|
|
749
752
|
max_num_nodes = self.backend.num_qubits + 1
|
|
750
753
|
else:
|
|
@@ -752,7 +755,7 @@ class QScoreBenchmark(Benchmark):
|
|
|
752
755
|
else:
|
|
753
756
|
max_num_nodes = self.max_num_nodes
|
|
754
757
|
|
|
755
|
-
dataset.attrs.update({"max_num_nodes":
|
|
758
|
+
dataset.attrs.update({"max_num_nodes": max_num_nodes})
|
|
756
759
|
|
|
757
760
|
for num_nodes in range(self.min_num_nodes, max_num_nodes + 1):
|
|
758
761
|
qc_list = []
|
|
@@ -761,6 +764,11 @@ class QScoreBenchmark(Benchmark):
|
|
|
761
764
|
graph_list = []
|
|
762
765
|
qubit_set_list = []
|
|
763
766
|
theta_list = []
|
|
767
|
+
## updates the number of qubits to choose for the grpah problem.
|
|
768
|
+
if self.use_virtual_node:
|
|
769
|
+
updated_num_nodes = num_nodes - 1
|
|
770
|
+
else:
|
|
771
|
+
updated_num_nodes = num_nodes
|
|
764
772
|
|
|
765
773
|
qcvv_logger.debug(f"Executing on {self.num_instances} random graphs with {num_nodes} nodes.")
|
|
766
774
|
|
|
@@ -802,11 +810,11 @@ class QScoreBenchmark(Benchmark):
|
|
|
802
810
|
# Choose the qubit layout
|
|
803
811
|
|
|
804
812
|
if self.choose_qubits_routine.lower() == "naive":
|
|
805
|
-
qubit_set = self.choose_qubits_naive(
|
|
813
|
+
qubit_set = self.choose_qubits_naive(updated_num_nodes)
|
|
806
814
|
elif (
|
|
807
815
|
self.choose_qubits_routine.lower() == "custom" or self.choose_qubits_routine.lower() == "mapomatic"
|
|
808
816
|
):
|
|
809
|
-
qubit_set = self.choose_qubits_custom(
|
|
817
|
+
qubit_set = self.choose_qubits_custom(updated_num_nodes)
|
|
810
818
|
else:
|
|
811
819
|
raise ValueError('choose_qubits_routine must either be "naive" or "custom".')
|
|
812
820
|
qubit_set_list.append(qubit_set)
|
|
@@ -863,9 +871,17 @@ class QScoreBenchmark(Benchmark):
|
|
|
863
871
|
max_gates_per_batch=self.max_gates_per_batch,
|
|
864
872
|
)
|
|
865
873
|
qc_transpiled_list.append(transpiled_qc)
|
|
866
|
-
execution_results.append(retrieve_all_counts(jobs)[0][0])
|
|
867
874
|
qcvv_logger.setLevel(logging.INFO)
|
|
868
875
|
|
|
876
|
+
if self.REM:
|
|
877
|
+
rem_counts = apply_readout_error_mitigation(
|
|
878
|
+
backend, transpiled_qc, [retrieve_all_counts(jobs)[0][0]], self.mit_shots
|
|
879
|
+
)
|
|
880
|
+
rem_distribution = rem_counts[0][0].nearest_probability_distribution()
|
|
881
|
+
execution_results.append(rem_distribution)
|
|
882
|
+
else:
|
|
883
|
+
execution_results.append(retrieve_all_counts(jobs)[0][0])
|
|
884
|
+
|
|
869
885
|
seed += 1
|
|
870
886
|
qcvv_logger.debug(f"Solved the MaxCut on graph {instance+1}/{self.num_instances}.")
|
|
871
887
|
|
|
@@ -903,15 +919,21 @@ class QScoreConfiguration(BenchmarkConfigurationBase):
|
|
|
903
919
|
|
|
904
920
|
Attributes:
|
|
905
921
|
benchmark (Type[Benchmark]): QScoreBenchmark
|
|
906
|
-
num_instances (int):
|
|
907
|
-
num_qaoa_layers (int):
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
922
|
+
num_instances (int): Number of random graphs to be chosen.
|
|
923
|
+
num_qaoa_layers (int): Depth of the QAOA circuit.
|
|
924
|
+
* Default is 1.
|
|
925
|
+
min_num_nodes (int): The min number of nodes to be taken into account, which should be >= 2.
|
|
926
|
+
* Default is 2.
|
|
927
|
+
max_num_nodes (int): The max number of nodes to be taken into account, which has to be <= num_qubits + 1.
|
|
928
|
+
* Default is None
|
|
929
|
+
use_virtual_node (bool): Parameter to increase the potential Qscore by +1.
|
|
930
|
+
* Default is True.
|
|
931
|
+
use_classically_optimized_angles (bool): Use pre-optimised tuned parameters in the QAOA circuit.
|
|
932
|
+
* Default is True.
|
|
912
933
|
choose_qubits_routine (Literal["custom"]): The routine to select qubit layouts.
|
|
913
934
|
* Default is "custom".
|
|
914
|
-
min_num_qubits (int):
|
|
935
|
+
min_num_qubits (int): Minumum number of qubits.
|
|
936
|
+
* Default is 2
|
|
915
937
|
custom_qubits_array (Optional[Sequence[Sequence[int]]]): The physical qubit layouts to perform the benchmark on.
|
|
916
938
|
* Default is None.
|
|
917
939
|
qiskit_optim_level (int): The Qiskit transpilation optimization level.
|
|
@@ -920,6 +942,10 @@ class QScoreConfiguration(BenchmarkConfigurationBase):
|
|
|
920
942
|
* Default is True.
|
|
921
943
|
seed (int): The random seed.
|
|
922
944
|
* Default is 1.
|
|
945
|
+
REM (bool): Use readout error mitigation.
|
|
946
|
+
* Default is False.
|
|
947
|
+
mit_shots: (int): Number of shots used in readout error mitigation.
|
|
948
|
+
* Default is 1000.
|
|
923
949
|
"""
|
|
924
950
|
|
|
925
951
|
benchmark: Type[Benchmark] = QScoreBenchmark
|
|
@@ -935,3 +961,5 @@ class QScoreConfiguration(BenchmarkConfigurationBase):
|
|
|
935
961
|
qiskit_optim_level: int = 3
|
|
936
962
|
optimize_sqg: bool = True
|
|
937
963
|
seed: int = 1
|
|
964
|
+
REM: bool = False
|
|
965
|
+
mit_shots: int = 1000
|
iqm/benchmarks/utils.py
CHANGED
|
@@ -250,7 +250,7 @@ def perform_backend_transpilation(
|
|
|
250
250
|
transpiled = optimize_single_qubit_gates(transpiled, drop_final_rz=drop_final_rz)
|
|
251
251
|
if "move" in backend.operation_names:
|
|
252
252
|
transpiled = transpile_to_IQM(
|
|
253
|
-
|
|
253
|
+
qc, backend=backend, optimize_single_qubits=optimize_sqg, remove_final_rzs=drop_final_rz
|
|
254
254
|
)
|
|
255
255
|
if aux_qc is not None:
|
|
256
256
|
if "move" in backend.operation_names:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: iqm-benchmarks
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.16
|
|
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>
|
|
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>
|
|
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
|
|
@@ -4,14 +4,14 @@ 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=wOgf8x1Z-DsVUL5KQSaKXjGDXDBSvhmwg4Qo-vTOoo0,21172
|
|
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=
|
|
12
|
+
iqm/benchmarks/entanglement/ghz.py,sha256=0C3zppwGGn_gIkxRWkV_mYqpkygZsu1Ap-xV9PcN0wY,42668
|
|
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=q2gIU2blRagLfA6fU_iDg6WjdFgWMIqnKVvGgr-t3bI,36943
|
|
15
15
|
iqm/benchmarks/quantum_volume/__init__.py,sha256=i-Q4SpDWELBw7frXnxm1j4wJRcxbIyrS5uEK_v06YHo,951
|
|
16
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
|
|
@@ -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.16.dist-info/LICENSE,sha256=2Ncb40-hqkTil78RPv3-YiJfKaJ8te9USJgliKqIdSY,11558
|
|
40
|
+
iqm_benchmarks-2.16.dist-info/METADATA,sha256=5SuwCE3Uz6lhRtfFf6wxyUnHEmEkTV1dhAFtZdaVFVk,10253
|
|
41
|
+
iqm_benchmarks-2.16.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
42
|
+
iqm_benchmarks-2.16.dist-info/top_level.txt,sha256=3G23Z-1LGf-IOzTCUl6QwWqiQ3USz25Zt90Ihq192to,9
|
|
43
|
+
iqm_benchmarks-2.16.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|