From 5a12745eface1ffe0f8542dd8bca756383350363 Mon Sep 17 00:00:00 2001 From: Toshinari Itoko Date: Tue, 24 Oct 2023 09:34:27 +0900 Subject: [PATCH] Fix argumentis mismatch --- .../randomized_benchmarking/clifford_synthesis.py | 13 +++++++++---- .../library/randomized_benchmarking/standard_rb.py | 3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/qiskit_experiments/library/randomized_benchmarking/clifford_synthesis.py b/qiskit_experiments/library/randomized_benchmarking/clifford_synthesis.py index c4bc4220a5..29873fb37f 100644 --- a/qiskit_experiments/library/randomized_benchmarking/clifford_synthesis.py +++ b/qiskit_experiments/library/randomized_benchmarking/clifford_synthesis.py @@ -20,7 +20,7 @@ from qiskit.circuit.equivalence_library import SessionEquivalenceLibrary as sel from qiskit.exceptions import QiskitError from qiskit.synthesis.clifford import synth_clifford_full -from qiskit.transpiler import PassManager, CouplingMap, Layout +from qiskit.transpiler import PassManager, CouplingMap, Layout, Target from qiskit.transpiler.passes import ( SabreSwap, LayoutTransformation, @@ -38,8 +38,9 @@ class RBDefaultCliffordSynthesis(HighLevelSynthesisPlugin): def run( self, high_level_object: Operation, - basis_gates: Sequence[str] | None = None, coupling_map: CouplingMap | None = None, + target: Target | None = None, + qubits: Sequence | None = None, **options, ) -> QuantumCircuit: """Run synthesis for the given Clifford. @@ -47,11 +48,14 @@ def run( Args: high_level_object: The operation to synthesize to a :class:`~qiskit.circuit.QuantumCircuit` object. - basis_gates: The basis gates to be used for the synthesis. coupling_map: The reduced coupling map of the backend. For example, if physical qubits [5, 6, 7] to be benchmarked is connected as 5 - 7 - 6 linearly, the reduced coupling map is 0 - 2 - 1. - options: Additional method-specific optional kwargs. + target: A target representing the target backend, which will be ignored in this plugin. + qubits: List of physical qubits over which the operation is defined, + which will be ignored in this plugin. + options: Additional method-specific optional kwargs, + which must include ``basis_gates``, basis gates to be used for the synthesis. Returns: The quantum circuit representation of the Operation @@ -67,6 +71,7 @@ def run( if coupling_map is None: # Sabre does not work with coupling_map=None return circ + basis_gates = options.get("basis_gates", None) if basis_gates is None: raise QiskitError("basis_gates are required to run this synthesis plugin") diff --git a/qiskit_experiments/library/randomized_benchmarking/standard_rb.py b/qiskit_experiments/library/randomized_benchmarking/standard_rb.py index 60c2462767..ba6ae4f0e4 100644 --- a/qiskit_experiments/library/randomized_benchmarking/standard_rb.py +++ b/qiskit_experiments/library/randomized_benchmarking/standard_rb.py @@ -30,6 +30,7 @@ from qiskit.pulse.instruction_schedule_map import CalibrationPublisher from qiskit.quantum_info import Clifford from qiskit.quantum_info.random import random_clifford +from qiskit.transpiler import CouplingMap from qiskit_experiments.framework import BaseExperiment, Options from qiskit_experiments.framework.restless_mixin import RestlessMixin from .clifford_utils import ( @@ -251,7 +252,7 @@ def _get_synthesis_options(self) -> Dict[str, Optional[Any]]: backend_basis_gates = self.backend.configuration().basis_gates backend_cmap = self.backend.configuration().coupling_map if backend_cmap: - backend_cmap = backend_cmap.reduce(self.physical_qubits) + backend_cmap = CouplingMap(backend_cmap).reduce(self.physical_qubits) basis_gates = basis_gates if basis_gates else backend_basis_gates coupling_map = coupling_map if coupling_map else backend_cmap