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

@@ -27,6 +27,7 @@ from .benchmark_definition import (
27
27
  )
28
28
  from .circuit_containers import BenchmarkCircuit, CircuitGroup, Circuits
29
29
  from .entanglement.ghz import GHZBenchmark, GHZConfiguration
30
+ from .entanglement.graph_states import GraphStateBenchmark, GraphStateConfiguration
30
31
  from .optimization.qscore import QScoreBenchmark, QScoreConfiguration
31
32
  from .quantum_volume.clops import CLOPSBenchmark, CLOPSConfiguration
32
33
  from .quantum_volume.quantum_volume import QuantumVolumeBenchmark, QuantumVolumeConfiguration
@@ -46,6 +47,7 @@ AVAILABLE_BENCHMARKS = {
46
47
  InterleavedRandomizedBenchmarking.name: InterleavedRandomizedBenchmarking,
47
48
  MirrorRandomizedBenchmarking.name: MirrorRandomizedBenchmarking,
48
49
  QScoreBenchmark.name: QScoreBenchmark,
50
+ GraphStateBenchmark.name: GraphStateBenchmark,
49
51
  }
50
52
 
51
53
  try:
@@ -237,8 +237,12 @@ def generate_non_gate_results(
237
237
  else:
238
238
  df_o_final = DataFrame(
239
239
  {
240
- f"mean_total_variation_distance_estimate_data": reporting.number_to_str(df_o.values[0, 1].copy(), precision=5),
241
- f"mean_total_variation_distance_target_data": reporting.number_to_str(df_o.values[0, 2].copy(), precision=5),
240
+ f"mean_total_variation_distance_estimate_data": reporting.number_to_str(
241
+ df_o.values[0, 1].copy(), precision=5
242
+ ),
243
+ f"mean_total_variation_distance_target_data": reporting.number_to_str(
244
+ df_o.values[0, 2].copy(), precision=5
245
+ ),
242
246
  f"povm_diamond_distance": reporting.number_to_str(df_o.values[0, 3].copy(), precision=5),
243
247
  f"state_trace_distance": reporting.number_to_str(df_o.values[0, 4].copy(), precision=5),
244
248
  },
@@ -13,6 +13,7 @@
13
13
  # limitations under the License.
14
14
  """
15
15
  GHZ verifies the generation of Greenberger-Horne-Zeilinger states
16
+ Graph State estimates the amount of bipartite entanglement of native graph states
16
17
  """
17
18
 
18
- from . import ghz
19
+ from . import ghz, graph_states
@@ -205,7 +205,8 @@ def fidelity_analysis(run: BenchmarkRunResult) -> BenchmarkAnalysisResult:
205
205
  dataset = run.dataset
206
206
  routine = dataset.attrs["fidelity_routine"]
207
207
  qubit_layouts = dataset.attrs["custom_qubits_array"]
208
- backend_name = dataset.attrs["backend_name"]
208
+ backend_topology = dataset.attrs["backend_topology"]
209
+ backend_num_qubits = dataset.attrs["backend_num_qubits"]
209
210
 
210
211
  observation_list: list[BenchmarkObservation] = []
211
212
  for qubit_layout in qubit_layouts:
@@ -218,7 +219,7 @@ def fidelity_analysis(run: BenchmarkRunResult) -> BenchmarkAnalysisResult:
218
219
  for qc in all_circuits:
219
220
  qc_copy = qc.copy()
220
221
  qc_copy.remove_final_measurements()
221
- deflated_qc = reduce_to_active_qubits(qc_copy, backend_name)
222
+ deflated_qc = reduce_to_active_qubits(qc_copy, backend_topology, backend_num_qubits)
222
223
  ideal_probabilities.append(
223
224
  dict(sorted(ideal_simulator.run(deflated_qc).result().get_counts().items()))
224
225
  )
@@ -374,11 +375,11 @@ def generate_ghz_spanning_tree(
374
375
  participating_qubits = set(qubit for pair in cx_map[: n_state - 1] for qubit in pair)
375
376
 
376
377
  relabeling = {idx_old: idx_new for idx_new, idx_old in enumerate(participating_qubits)}
377
- n_state_register = QuantumRegister(n_state)
378
- qc = QuantumCircuit(n_state_register, name="ghz")
378
+ qc = QuantumCircuit(n_state, name="ghz")
379
379
  qc.h([relabeling[cx_map[0][0]]])
380
380
  for _, pair in zip(np.arange(n_state - 1), cx_map):
381
381
  relabeled_pair = [relabeling[pair[0]], relabeling[pair[1]]]
382
+ # This barrier prevents Hadamards from being put at the beginning of the circuit, which would make it more susceptible to phase errors
382
383
  qc.barrier(relabeled_pair)
383
384
  qc.cx(*relabeled_pair)
384
385
  qc.measure_active()
@@ -620,14 +621,11 @@ class GHZBenchmark(Benchmark):
620
621
  qcvv_logger.warning(
621
622
  f"The current backend is a star architecture for which a suboptimal state generation routine is chosen. Consider setting state_generation_routine={routine}."
622
623
  )
623
- effective_coupling_map = [[x, y] for x in qubit_layout for y in qubit_layout if x != y]
624
- else:
625
- effective_coupling_map = self.backend.coupling_map
626
624
  if self.cal_url:
627
625
  edges_cal, fidelities_cal, _ = extract_fidelities(self.cal_url)
628
- graph = get_edges(effective_coupling_map, qubit_layout, edges_cal, fidelities_cal)
626
+ graph = get_edges(self.backend.coupling_map, qubit_layout, edges_cal, fidelities_cal)
629
627
  else:
630
- graph = get_edges(effective_coupling_map, qubit_layout)
628
+ graph = get_edges(self.backend.coupling_map, qubit_layout)
631
629
  ghz, _ = generate_ghz_spanning_tree(graph, qubit_layout, qubit_count)
632
630
  circuit_group.add_circuit(ghz)
633
631
  ghz_native_transpiled, _ = perform_backend_transpilation(
@@ -670,7 +668,7 @@ class GHZBenchmark(Benchmark):
670
668
  else:
671
669
  index_min_depth = np.argmin([c.depth() for c in ghz_native_transpiled])
672
670
  final_ghz = ghz_native_transpiled[index_min_depth]
673
- circuit_group.add_circuit([ghz_log[index_min_depth]])
671
+ circuit_group.add_circuit(ghz_log[index_min_depth])
674
672
  self.circuits["untranspiled_circuits"].circuit_groups.append(circuit_group)
675
673
  return CircuitGroup(name=f"{qubit_layout}_native_ghz", circuits=[final_ghz[0]])
676
674
 
@@ -821,6 +819,8 @@ class GHZBenchmark(Benchmark):
821
819
  else:
822
820
  dataset.attrs[key] = value
823
821
  dataset.attrs[f"backend_name"] = self.backend.name
822
+ dataset.attrs[f"backend_topology"] = "star" if "move" in self.backend.operation_names else "crystal"
823
+ dataset.attrs[f"backend_num_qubits"] = self.backend.num_qubits
824
824
  dataset.attrs[f"execution_timestamp"] = self.execution_timestamp
825
825
  dataset.attrs["fidelity_routine"] = self.fidelity_routine
826
826