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.

@@ -856,7 +856,7 @@ class QScoreBenchmark(Benchmark):
856
856
  else:
857
857
  qcvv_logger.setLevel(logging.WARNING)
858
858
  # Account for all-to-all connected backends like Deneb
859
- if "move" in self.backend.operation_names:
859
+ if "move" in backend.architecture.gates:
860
860
  # If the circuit is defined on a subset of qubit_set, choose the first qubtis in the set
861
861
  active_qubit_set = qubit_set[: len(qc.qubits)]
862
862
  # All-to-all coupling map on the active qubits
@@ -514,7 +514,7 @@ class CLOPSBenchmark(Benchmark):
514
514
  parameters = self.generate_random_parameters()
515
515
 
516
516
  # Star can't use optimize_sqg as is, yet -> complains about MOVE gate not being IQM native!
517
- if optimize_sqg and "move" not in self.backend.operation_names:
517
+ if optimize_sqg and "move" not in self.backend.architecture.gates:
518
518
  sorted_dict_parametrized[k].append(
519
519
  optimize_single_qubit_gates( # Optimize SQG seems worth it AFTER assignment
520
520
  qc.assign_parameters(
@@ -38,10 +38,6 @@ from iqm.benchmarks.benchmark_definition import (
38
38
  BenchmarkRunResult,
39
39
  add_counts_to_dataset,
40
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
41
  from iqm.benchmarks.circuit_containers import BenchmarkCircuit, CircuitGroup, Circuits
46
42
  from iqm.benchmarks.logging_config import qcvv_logger
47
43
  from iqm.benchmarks.readout_mitigation import apply_readout_error_mitigation
@@ -677,12 +673,13 @@ class QuantumVolumeBenchmark(Benchmark):
677
673
  sorted_transpiled_qc_list: Dict[Tuple[int, ...], List[QuantumCircuit]],
678
674
  ) -> Dict[str, Any]:
679
675
  """
680
- Submit jobs for execution in the specified IQMBackend.
676
+ Submit a single set of QV jobs for execution in the specified IQMBackend:
677
+ Organizes the results in a dictionary with the qubit layout, the submitted job objects, the type of QV results and submission time.
681
678
 
682
679
  Args:
683
680
  backend (IQMBackendBase): the IQM backend to submit the job.
684
681
  qubits (List[int]): the qubits to identify the submitted job.
685
- sorted_transpiled_qc_list (Dict[str, List[QuantumCircuit]]): qubits to submit jobs to.
682
+ sorted_transpiled_qc_list (Dict[Tuple[int, ...] | str, List[QuantumCircuit]]): A dictionary of Lists of quantum circuits.
686
683
  Returns:
687
684
  Dict with qubit layout, submitted job objects, type (vanilla/DD) and submission time.
688
685
  """
@@ -332,7 +332,7 @@ def generate_pauli_dressed_mrb_circuits(
332
332
 
333
333
  # Add measurements to transpiled - before!
334
334
  circ.measure_all()
335
- if "move" in retrieved_backend.operation_names:
335
+ if "move" in retrieved_backend.architecture.gates:
336
336
  # All-to-all coupling map on the active qubits
337
337
  effective_coupling_map = [[x, y] for x in qubits for y in qubits if x != y]
338
338
  else:
@@ -380,17 +380,42 @@ def get_survival_probabilities(num_qubits: int, counts: List[Dict[str, int]]) ->
380
380
  return [c["0" * num_qubits] / sum(c.values()) if "0" * num_qubits in c.keys() else 0 for c in counts]
381
381
 
382
382
 
383
- def import_native_gate_cliffords() -> Tuple[Dict[str, QuantumCircuit], Dict[str, QuantumCircuit]]:
383
+ def import_native_gate_cliffords(
384
+ system_size: Optional[str] = None,
385
+ ) -> Dict[str, QuantumCircuit] | Tuple[Dict[str, QuantumCircuit], Dict[str, QuantumCircuit]]:
384
386
  """Import native gate Clifford dictionaries
387
+
388
+ Args:
389
+ system_size (str, optional): System size to load, either "1q" or "2q". If None, load both dictionaries.
390
+
385
391
  Returns:
386
- Dictionaries of 1Q and 2Q Clifford gates
392
+ If system_size is specified, returns the dictionary for that system size.
393
+ If system_size is None, returns a tuple of (1q_dict, 2q_dict).
394
+
395
+ Raises:
396
+ ValueError: If system_size is not None, "1q", or "2q".
387
397
  """
388
- # Import the native-gate Cliffords
389
- with open(os.path.join(os.path.dirname(__file__), "clifford_1q.pkl"), "rb") as f1q:
390
- clifford_1q_dict = pickle.load(f1q)
391
- with open(os.path.join(os.path.dirname(__file__), "clifford_2q.pkl"), "rb") as f2q:
392
- clifford_2q_dict = pickle.load(f2q)
393
- qcvv_logger.info("Clifford dictionaries imported successfully !")
398
+ if system_size is not None and system_size not in ["1q", "2q"]:
399
+ raise ValueError('system_size must be either "1q", "2q", or None')
400
+
401
+ clifford_1q_dict = {}
402
+ clifford_2q_dict = {}
403
+
404
+ if system_size is None or system_size == "1q":
405
+ with open(os.path.join(os.path.dirname(__file__), "clifford_1q.pkl"), "rb") as f1q:
406
+ clifford_1q_dict = pickle.load(f1q)
407
+
408
+ if system_size is None or system_size == "2q":
409
+ with open(os.path.join(os.path.dirname(__file__), "clifford_2q.pkl"), "rb") as f2q:
410
+ clifford_2q_dict = pickle.load(f2q)
411
+
412
+ qcvv_logger.info(f"Clifford dictionaries for {system_size or 'both systems'} imported successfully!")
413
+
414
+ if system_size == "1q":
415
+ return clifford_1q_dict
416
+ if system_size == "2q":
417
+ return clifford_2q_dict
418
+
394
419
  return clifford_1q_dict, clifford_2q_dict
395
420
 
396
421