iqm-benchmarks 2.52__py3-none-any.whl → 2.54__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.
@@ -690,7 +690,7 @@ class GHZBenchmark(Benchmark):
690
690
  f"The current backend is a star architecture for which a suboptimal state generation routine is chosen. Consider setting state_generation_routine={routine}."
691
691
  )
692
692
  if self.cal_url:
693
- edges_cal, fidelities_cal, _ = extract_fidelities(self.cal_url)
693
+ edges_cal, fidelities_cal, _, _ = extract_fidelities(self.cal_url)
694
694
  graph = get_edges(self.backend.coupling_map, qubit_layout, edges_cal, fidelities_cal)
695
695
  else:
696
696
  graph = get_edges(self.backend.coupling_map, qubit_layout)
@@ -541,12 +541,12 @@ def qscore_analysis(run: BenchmarkRunResult) -> BenchmarkAnalysisResult:
541
541
 
542
542
  if success:
543
543
  qcvv_logger.info(
544
- f"Q-Score = {num_nodes} passed with approximation ratio (Beta) {approximation_ratio:.4f}; Avg MaxCut size: {np.mean(cut_sizes_list):.4f}"
544
+ f"Q-Score = {num_nodes} passed with approximation ratio (Beta) {approximation_ratio:.4f} ± {std_of_approximation_ratio:.4f} with uncertainty; Avg MaxCut size: {np.mean(cut_sizes_list):.4f}"
545
545
  )
546
546
  qscore = num_nodes
547
547
  else:
548
548
  qcvv_logger.info(
549
- f"Q-Score = {num_nodes} failed with approximation ratio (Beta) {approximation_ratio:.4f} < 0.2; Avg MaxCut size: {np.mean(cut_sizes_list):.4f}"
549
+ f"Q-Score = {num_nodes} failed with approximation ratio (Beta) {approximation_ratio:.4f} ± {std_of_approximation_ratio:.4f} < 0.2; Avg MaxCut size: {np.mean(cut_sizes_list):.4f}"
550
550
  )
551
551
  qubit_indices = dataset.attrs[num_nodes]["qubit_set"][0]
552
552
  observations.extend(
@@ -726,31 +726,40 @@ class QScoreBenchmark(Benchmark):
726
726
 
727
727
  def generate_maxcut_ansatz_star( # pylint: disable=too-many-branches
728
728
  self,
729
- graph,
730
- theta,
729
+ graph: Graph,
730
+ theta: list[float],
731
+ qubit_set: Optional[list[int]] = None,
731
732
  ):
732
733
  """Generate an ansatz circuit for QAOA MaxCut, with measurements at the end.
733
734
 
734
735
  Args:
735
736
  graph (networkx graph): the MaxCut problem graph
736
737
  theta (list[float]): the variational parameters for QAOA, first gammas then betas
738
+ qubit_set (list[int]): the qubit set to be used for the ansatz
737
739
 
738
740
  Returns:
739
741
  QuantumCircuit: the QAOA ansatz quantum circuit.
740
742
  """
741
-
742
743
  gamma = theta[: self.num_qaoa_layers]
743
744
  beta = theta[self.num_qaoa_layers :]
744
-
745
+ if qubit_set is None:
746
+ qubit_set_resonator = list(range(self.graph_physical.number_of_nodes() + 1))
747
+ qubit_set_resonator = [q + 1 for q in qubit_set_resonator]
748
+ else:
749
+ qubit_set_resonator = [q + 1 for q in qubit_set]
745
750
  if self.graph_physical.number_of_nodes() != graph.number_of_nodes():
746
751
  num_qubits = self.graph_physical.number_of_nodes()
747
752
  # re-label the nodes to be between 0 and _num_qubits
748
- self.node_to_qubit = {node: qubit for qubit, node in enumerate(list(self.graph_physical.nodes))}
753
+ self.node_to_qubit = {
754
+ node: qubit_set_resonator[qubit] for qubit, node in enumerate(list(self.graph_physical.nodes))
755
+ }
749
756
  self.qubit_to_node = dict(enumerate(list(self.graph_physical.nodes)))
750
757
  else:
751
758
  num_qubits = graph.number_of_nodes()
752
- self.node_to_qubit = {node: node for node in list(self.graph_physical.nodes)} # no relabeling
753
- self.qubit_to_node = self.node_to_qubit
759
+ self.node_to_qubit = {
760
+ node: qubit_set_resonator[node] for node in list(self.graph_physical.nodes)
761
+ } # no relabeling
762
+ self.qubit_to_node = {node: node for node in list(self.graph_physical.nodes)}
754
763
 
755
764
  covermap = self.greedy_vertex_cover_with_mapping(self.graph_physical)
756
765
  new_covermap = {}
@@ -759,20 +768,22 @@ class QScoreBenchmark(Benchmark):
759
768
  covermap = new_covermap
760
769
 
761
770
  compr = QuantumRegister(1, "compr")
762
- q = QuantumRegister(num_qubits, "q")
771
+ q = QuantumRegister(self.backend.num_qubits, "q")
763
772
  c = ClassicalRegister(num_qubits, "c")
764
- qaoa_qc = IQMCircuit(compr, q, c) # num_qb+1,num_qb)
773
+ qaoa_qc = IQMCircuit(compr, q, c)
774
+ qubit_list = list(self.node_to_qubit.values())
775
+
765
776
  # in case the graph is trivial: return empty circuit
766
777
  if num_qubits == 0:
767
778
  return QuantumCircuit(1)
768
- for i in range(1, num_qubits + 1):
779
+ for i in qubit_list:
769
780
  qaoa_qc.h(i)
770
781
  for layer in range(self.num_qaoa_layers):
771
782
  for move_qubit, edge_qubits in covermap.items():
772
- qaoa_qc.move(move_qubit + 1, 0)
783
+ qaoa_qc.move(move_qubit, 0)
773
784
  for edge_qubit in edge_qubits:
774
- qaoa_qc.rzz(2 * gamma[layer], 0, edge_qubit + 1)
775
- qaoa_qc.move(move_qubit + 1, 0)
785
+ qaoa_qc.rzz(2 * gamma[layer], 0, edge_qubit)
786
+ qaoa_qc.move(move_qubit, 0)
776
787
 
777
788
  # include edges of the virtual node as rz terms
778
789
  for vn in self.virtual_nodes:
@@ -784,13 +795,13 @@ class QScoreBenchmark(Benchmark):
784
795
  sign = 1.0
785
796
  if vn[1] == 1:
786
797
  sign = -1.0
787
- qaoa_qc.rz(sign * 2.0 * gamma[layer], self.node_to_qubit[edge[1]] + 1)
798
+ qaoa_qc.rz(sign * 2.0 * gamma[layer], self.node_to_qubit[edge[1]])
788
799
 
789
- for i in range(1, num_qubits + 1):
800
+ for i in qubit_list:
790
801
  qaoa_qc.rx(2 * beta[layer], i)
791
- qaoa_qc.barrier()
792
- qaoa_qc.measure(q, c)
793
802
 
803
+ qaoa_qc.barrier()
804
+ qaoa_qc.measure(qubit_list, list(range(num_qubits)))
794
805
  return qaoa_qc
795
806
 
796
807
  def generate_maxcut_ansatz( # pylint: disable=too-many-branches
@@ -923,8 +934,6 @@ class QScoreBenchmark(Benchmark):
923
934
  dataset = xr.Dataset()
924
935
  self.add_all_meta_to_dataset(dataset)
925
936
 
926
- nqubits = self.backend.num_qubits
927
-
928
937
  if self.choose_qubits_routine == "custom":
929
938
  if self.use_virtual_node:
930
939
  node_numbers = [len(qubit_layout) + 1 for qubit_layout in self.custom_qubits_array]
@@ -932,11 +941,8 @@ class QScoreBenchmark(Benchmark):
932
941
  node_numbers = [len(qubit_layout) for qubit_layout in self.custom_qubits_array]
933
942
 
934
943
  else:
935
- if self.max_num_nodes is None or self.max_num_nodes == nqubits + 1:
936
- if self.use_virtual_node:
937
- max_num_nodes = nqubits + 1
938
- else:
939
- max_num_nodes = nqubits
944
+ if self.use_virtual_node: ## if nqubits are used then with virtual node, max_num_nodes is nqubits + 1
945
+ max_num_nodes = self.max_num_nodes + 1
940
946
  else:
941
947
  max_num_nodes = self.max_num_nodes
942
948
  node_numbers = list(range(self.min_num_nodes, max_num_nodes + 1))
@@ -1031,24 +1037,29 @@ class QScoreBenchmark(Benchmark):
1031
1037
  else:
1032
1038
  theta = get_optimal_angles(self.num_qaoa_layers)
1033
1039
 
1034
- theta_list.append(theta)
1035
-
1036
1040
  if self.backend.has_resonators():
1037
- qc_opt = self.generate_maxcut_ansatz_star(graph, theta)
1041
+ qc_opt = self.generate_maxcut_ansatz_star(graph, theta, active_qubit_set)
1038
1042
  else:
1039
1043
  qc_list_temp = []
1040
1044
  cz_count_temp = []
1045
+ theta_temp = []
1041
1046
  for _ in range(self.num_trials):
1042
1047
  perm = np.random.permutation(num_nodes)
1043
1048
  mapping = dict(zip(graph.nodes, perm))
1044
1049
  G1_permuted = nx.relabel_nodes(graph, mapping)
1045
- theta = calculate_optimal_angles_for_QAOA_p1(G1_permuted)
1050
+ theta = (
1051
+ calculate_optimal_angles_for_QAOA_p1(G1_permuted)
1052
+ if G1_permuted.number_of_edges() != 0
1053
+ else [1.0, 1.0]
1054
+ )
1046
1055
  qc_perm = self.generate_maxcut_ansatz(G1_permuted, theta)
1047
1056
  transpiled_qc_temp, _ = perform_backend_transpilation([qc_perm], **transpilation_params)
1048
1057
  cz_count_temp.append(transpiled_qc_temp[0].count_ops().get("cz", 0))
1049
1058
  qc_list_temp.append(qc_perm)
1059
+ theta_temp.append(theta)
1050
1060
  min_cz_index = cz_count_temp.index(min(cz_count_temp))
1051
1061
  qc_opt = qc_list_temp[min_cz_index]
1062
+ theta_list.append(theta_temp[min_cz_index])
1052
1063
 
1053
1064
  if len(qc_opt.count_ops()) != 0:
1054
1065
  qc_list.append(qc_opt)
@@ -1144,7 +1155,6 @@ class QScoreConfiguration(BenchmarkConfigurationBase):
1144
1155
  min_num_nodes (int): The min number of nodes to be taken into account, which should be >= 2.
1145
1156
  * Default is 2.
1146
1157
  max_num_nodes (int): The max number of nodes to be taken into account, which has to be <= num_qubits + 1.
1147
- * Default is None
1148
1158
  use_virtual_node (bool): Parameter to increase the potential Qscore by +1.
1149
1159
  * Default is True.
1150
1160
  use_classically_optimized_angles (bool): Use pre-optimised tuned parameters in the QAOA circuit.
@@ -1174,7 +1184,7 @@ class QScoreConfiguration(BenchmarkConfigurationBase):
1174
1184
  num_instances: int
1175
1185
  num_qaoa_layers: int = 1
1176
1186
  min_num_nodes: int = 2
1177
- max_num_nodes: Optional[int] = None
1187
+ max_num_nodes: int
1178
1188
  use_virtual_node: bool = True
1179
1189
  use_classically_optimized_angles: bool = True
1180
1190
  choose_qubits_routine: Literal["naive", "custom"] = "naive"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iqm-benchmarks
3
- Version: 2.52
3
+ Version: 2.54
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>, 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
@@ -19,8 +19,9 @@ Requires-Dist: networkx<4.0,>=3.3
19
19
  Requires-Dist: rustworkx>=0.16.0
20
20
  Requires-Dist: numpy<2.0,>=1.25.2
21
21
  Requires-Dist: qiskit<=1.4.2,>=1.2.4
22
- Requires-Dist: iqm-client[qiskit]<33.0,>=32.1.1
23
- Requires-Dist: iqm-station-control-client<12.0,>=11.3.1
22
+ Requires-Dist: iqm-client[qiskit]<34.0,>=32.1.1
23
+ Requires-Dist: qiskit-ibm-runtime<0.44.0
24
+ Requires-Dist: iqm-station-control-client<13.0,>=11.3.1
24
25
  Requires-Dist: requests<3.0,>=2.32.3
25
26
  Requires-Dist: scikit-optimize<0.11.0,>=0.10.2
26
27
  Requires-Dist: tabulate<1.0.0,>=0.9.0
@@ -13,10 +13,10 @@ iqm/benchmarks/compressive_gst/__init__.py,sha256=LneifgYXtcwo2jcXo7GdUEHL6_peip
13
13
  iqm/benchmarks/compressive_gst/compressive_gst.py,sha256=_thQfc9qmIJqAcS3Kg4ITEYl8Ofi8xgC_oZotrmyzVk,28484
14
14
  iqm/benchmarks/compressive_gst/gst_analysis.py,sha256=H6EQGbpI_sig69Jy6hflg6alMTtjB0t9tHftygzA2YA,41240
15
15
  iqm/benchmarks/entanglement/__init__.py,sha256=sHVVToRWRCz0LSntk1rQaoSNNeyZLPoiTjUKWZWrk1E,778
16
- iqm/benchmarks/entanglement/ghz.py,sha256=drTmV2JQi9ZYr2_Gl28aizFDbV4TQ2NYynsRou-6re0,45946
16
+ iqm/benchmarks/entanglement/ghz.py,sha256=L4NyOaSlIgUjqOPzWDz8Kxob1A9d-rK7fQqNWB6fRXA,45949
17
17
  iqm/benchmarks/entanglement/graph_states.py,sha256=6qACedd3UXpiowXc9GW4QhSwO-CzHXnBA3dIC6nCIbE,62788
18
18
  iqm/benchmarks/optimization/__init__.py,sha256=_ajW_OibYLCtzU5AUv5c2zuuVYn8ZNeZUcUUSIGt51M,747
19
- iqm/benchmarks/optimization/qscore.py,sha256=iDbL9aKR-fgw1kQA7cdjkEjwKW6ySufs9kexXgzxwMk,46058
19
+ iqm/benchmarks/optimization/qscore.py,sha256=7JJIVrJvmec77kSdwM4YkwJJoNBCT-LuZ7Ay8JMZ7Nc,46847
20
20
  iqm/benchmarks/quantum_volume/__init__.py,sha256=i-Q4SpDWELBw7frXnxm1j4wJRcxbIyrS5uEK_v06YHo,951
21
21
  iqm/benchmarks/quantum_volume/clops.py,sha256=EUtO-_OYBYvwqb4xY3aubI2gc2Z6cBokRzt_E0608WA,31242
22
22
  iqm/benchmarks/quantum_volume/quantum_volume.py,sha256=af9C4SdEPcYyZgQgtJYy2h_F8QWv1a0hEtN6hr4KeM0,36861
@@ -35,7 +35,7 @@ iqm/benchmarks/randomized_benchmarking/interleaved_rb/__init__.py,sha256=sq6MgN_
35
35
  iqm/benchmarks/randomized_benchmarking/interleaved_rb/interleaved_rb.py,sha256=OHoAWajCE48dRDInwQUT8VvtzKad0ExefdqvZFTaYzs,28918
36
36
  iqm/benchmarks/randomized_benchmarking/mirror_rb/__init__.py,sha256=jRKbivWCZ3xdO1k0sx-ygC3s5DUkGSModd975PoAtcg,692
37
37
  iqm/benchmarks/randomized_benchmarking/mirror_rb/mirror_rb.py,sha256=ijieNymik3BeEUpXS-m64mtgdHz9iAFELuLooHeZY0E,33252
38
- iqm_benchmarks-2.52.dist-info/licenses/LICENSE,sha256=2Ncb40-hqkTil78RPv3-YiJfKaJ8te9USJgliKqIdSY,11558
38
+ iqm_benchmarks-2.54.dist-info/licenses/LICENSE,sha256=2Ncb40-hqkTil78RPv3-YiJfKaJ8te9USJgliKqIdSY,11558
39
39
  mGST/LICENSE,sha256=TtHNq55cUcbglb7uhVudeBLUh_qPdUoAEvU0BBwFz-k,1098
40
40
  mGST/README.md,sha256=v_5kw253csHF4-RfE-44KqFmBXIsSMRmOtN0AUPrRxE,5050
41
41
  mGST/additional_fns.py,sha256=MV0Pm5ap59IjhT_E3QhsZyM7lXOF1RZ9SD11zoaf43A,31781
@@ -46,7 +46,7 @@ mGST/optimization.py,sha256=x9tJ9wMQ5aONWpNpBMVtK0rwE6DRcOU33htNgrt0tx4,11015
46
46
  mGST/qiskit_interface.py,sha256=uCdn-Q9CXI2f4FQSxGUy8GmmzQhr9NhCOFb2VPj0gTs,10061
47
47
  mGST/reporting/figure_gen.py,sha256=xFPAHx1Trdqz7swn0kRqwc_jbRaNxhG9Nvx0jeitooo,25847
48
48
  mGST/reporting/reporting.py,sha256=Wss1-zFsMEhzrrXKfP-RICau80ezjDIzcN555KhSehc,34160
49
- iqm_benchmarks-2.52.dist-info/METADATA,sha256=sgMF6sIgC9aFl-8ylHXenilP3QSrM93s-RT30FSuEmk,10968
50
- iqm_benchmarks-2.52.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
51
- iqm_benchmarks-2.52.dist-info/top_level.txt,sha256=3G23Z-1LGf-IOzTCUl6QwWqiQ3USz25Zt90Ihq192to,9
52
- iqm_benchmarks-2.52.dist-info/RECORD,,
49
+ iqm_benchmarks-2.54.dist-info/METADATA,sha256=YW717J-dTO5FVIaGkmYeuZwK_FYSS71uqxvGc3-vI70,11009
50
+ iqm_benchmarks-2.54.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
51
+ iqm_benchmarks-2.54.dist-info/top_level.txt,sha256=3G23Z-1LGf-IOzTCUl6QwWqiQ3USz25Zt90Ihq192to,9
52
+ iqm_benchmarks-2.54.dist-info/RECORD,,