Skip to content

Commit

Permalink
Fix argumentis mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
itoko committed Oct 24, 2023
1 parent cafe761 commit 5a12745
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -38,20 +38,24 @@ 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.
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
Expand All @@ -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")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 5a12745

Please sign in to comment.