From a34df8c4e8b8ea0ca1fc4ff0d99cfe509a3b53ca Mon Sep 17 00:00:00 2001 From: Will Shanks Date: Mon, 30 Oct 2023 13:23:22 -0400 Subject: [PATCH] Allow StandardRB to handle a V2 backend without a coupling map (#1293) `StandardRB` handles directed two-qubit gates differently from bi-directional ones. For `BackendV2`, it used the `coupling_map` to check for directionality but did not handle the case where the coupling map was `None` which implies all to all connectivity. With this change, `StandardRB` treats gates with no coupling map as bidirectional. This issue first surfaced with qiskit-aer 0.13.0 which made `AerSimulator` a `BackendV2` backend (https://github.com/Qiskit-Extensions/qiskit-experiments/issues/1292). --- .../library/randomized_benchmarking/standard_rb.py | 3 +++ .../notes/rb-v2-none-coupling-fda2b22afdef507b.yaml | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 releasenotes/notes/rb-v2-none-coupling-fda2b22afdef507b.yaml diff --git a/qiskit_experiments/library/randomized_benchmarking/standard_rb.py b/qiskit_experiments/library/randomized_benchmarking/standard_rb.py index 3da209f07a..97e8e71ea2 100644 --- a/qiskit_experiments/library/randomized_benchmarking/standard_rb.py +++ b/qiskit_experiments/library/randomized_benchmarking/standard_rb.py @@ -241,6 +241,9 @@ def _get_basis_gates(self) -> Optional[Tuple[str, ...]]: return tuple(sorted(basis_gates)) if basis_gates else None def is_bidirectional(coupling_map): + if coupling_map is None: + # None for a coupling map implies all-to-all coupling + return True return len(coupling_map.reduce(self.physical_qubits).get_edges()) == 2 # 2 qubits case: Return all basis gates except for one-way directed 2q-gates. diff --git a/releasenotes/notes/rb-v2-none-coupling-fda2b22afdef507b.yaml b/releasenotes/notes/rb-v2-none-coupling-fda2b22afdef507b.yaml new file mode 100644 index 0000000000..4df8316ac8 --- /dev/null +++ b/releasenotes/notes/rb-v2-none-coupling-fda2b22afdef507b.yaml @@ -0,0 +1,12 @@ +--- +fixes: + - | + Changed :class:`.StandardRB` to treat two qubit operations in the + :class:`qiskit.transpiler.Target` as having all-to-all connectivity if + there is no set of specific pairs of coupled qubits. Most importantly, this + change allows :class:`.StandardRB` to work with + :class:`qiskit_aer.AerSimulator` for multi-qubit benchmarking after + ``qiskit-aer`` 0.13.0. Version 0.13.0 of ``qiskit-aer`` changed + the default :class:`qiskit_aer.AerSimulator` to have such a + :class:`qiskit.transpiler.Target` without specific coupled pairs. + See `#1292 `__.