Skip to content

Commit

Permalink
Merge branch 'Qiskit-Extensions:main' into Setting-type-for-composite…
Browse files Browse the repository at this point in the history
…-experiment
  • Loading branch information
nayan2167 authored Nov 1, 2023
2 parents 5c68554 + 39a0d87 commit ce63ed3
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 12 additions & 0 deletions releasenotes/notes/rb-v2-none-coupling-fda2b22afdef507b.yaml
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/Qiskit-Extensions/qiskit-experiments/issues/1292>`__.
2 changes: 1 addition & 1 deletion requirements-extras.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
qiskit-ibm-provider>=0.6.1 # for submitting experiments to backends through the IBM provider
cvxpy>=1.3.2 # for tomography
scikit-learn # for discriminators
qiskit-aer>=0.11.0,<=0.12.2 # Temporary version pin because of https://github.com/Qiskit-Extensions/qiskit-experiments/issues/1292
qiskit-aer>=0.11.0
qiskit_dynamics>=0.4.0 # for the PulseBackend
28 changes: 23 additions & 5 deletions test/library/randomized_benchmarking/test_standard_rb.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,29 @@ def test_three_qubit(self):

def test_add_more_circuit_yields_lower_variance(self):
"""Test variance reduction with larger number of sampling."""

# Increase single qubit error so that we can see gate error with a
# small number of Cliffords since we want to run many samples without
# taking too long.
p1q = 0.15
pvz = 0.0

# setup noise model
sx_error = depolarizing_error(p1q, 1)
rz_error = depolarizing_error(pvz, 1)

noise_model = NoiseModel()
noise_model.add_all_qubit_quantum_error(sx_error, "sx")
noise_model.add_all_qubit_quantum_error(rz_error, "rz")

# Aer simulator
backend = AerSimulator(noise_model=noise_model, seed_simulator=123)

exp1 = rb.StandardRB(
physical_qubits=(0, 1),
physical_qubits=(0,),
lengths=list(range(1, 30, 3)),
seed=123,
backend=self.backend,
backend=backend,
num_samples=3,
)
exp1.analysis.set_options(gate_error_ratio=None)
Expand All @@ -332,11 +350,11 @@ def test_add_more_circuit_yields_lower_variance(self):
self.assertExperimentDone(expdata1)

exp2 = rb.StandardRB(
physical_qubits=(0, 1),
physical_qubits=(0,),
lengths=list(range(1, 30, 3)),
seed=456,
backend=self.backend,
num_samples=5,
backend=backend,
num_samples=30,
)
exp2.analysis.set_options(gate_error_ratio=None)
exp2.set_transpile_options(**self.transpiler_options)
Expand Down
4 changes: 3 additions & 1 deletion test/library/tomography/tomo_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ def readout_noise_model(num_qubits, seed=None):
p1g0s = 0.15 * rng.random(num_qubits)
p0g1s = 0.3 * rng.random(num_qubits)
amats = np.stack([[1 - p1g0s, p1g0s], [p0g1s, 1 - p0g1s]]).T
noise_model = NoiseModel()
# Set `basis_gates` so that reset is included.
# See https://github.com/Qiskit/qiskit-aer/issues/1975
noise_model = NoiseModel(basis_gates=["id", "rz", "sx", "cx", "reset"])
for i, amat in enumerate(amats):
noise_model.add_readout_error(amat.T, [i])
return noise_model

0 comments on commit ce63ed3

Please sign in to comment.