laboneq_applications.experiments.two_qubit_rb
¶
This module defines a two-qubit randomized benchmarking experiment.
In this experiment, random sequences of two-qubit Clifford gates are applied to qubit pairs, followed by a recovery gate that should return the system to |00⟩ for perfect gates.
The experiment has the following pulse sequence:
qb0 --- [2q-clifford sequence] --- [recovery gate] --- [ measure ]
qb1 --- [2q-clifford sequence] --- [recovery gate] --- [ measure ]
If multiple qubit pairs are passed, the above pulses are applied in parallel on all pairs. A different random Clifford sequence is played on each pair. Shorter sequences start later, so that every sequence ends right before the measurement.
TwoQubitRBExperimentOptions
¶
Experiment options for two-qubit randomized benchmarking.
Sets averaging_mode to SINGLE_SHOT and acquisition_type to
DISCRIMINATION, the only values that create_experiment accepts. The
analysis computes the joint populations of each pair from the states that
the single shots of its qubits are assigned to.
acquisition_type = workflow.option_field(AcquisitionType.DISCRIMINATION, description='Acquisition type. Must be DISCRIMINATION.', converter=AcquisitionType)
class-attribute
instance-attribute
¶
averaging_mode = workflow.option_field(AveragingMode.SINGLE_SHOT, description='Averaging mode. Must be SINGLE_SHOT.', converter=AveragingMode)
class-attribute
instance-attribute
¶
create_experiment(qpu, qubits, qubit_pairs, clifford_sequences, options=None)
¶
Creates a two-qubit randomized benchmarking experiment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qpu
|
QPU
|
The qpu consisting of the original qubits and quantum operations. |
required |
qubits
|
QuantumElements
|
The qubits and couplers that flatten_qubit_pairs returns.
|
required |
qubit_pairs
|
list[list[str]]
|
List of [q0, q1] qubit pairs to run the experiments on, passed by UID. The pairs must not share qubits. |
required |
clifford_sequences
|
dict[str, tuple[list[tuple], ...]]
|
The RB sequences of each pair, keyed by |
required |
options
|
TwoQubitRBExperimentOptions | None
|
The options for building the workflow. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
experiment |
Experiment
|
The generated LabOne Q experiment instance to be compiled and executed. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If two pairs share a qubit, if the |
experiment_workflow(session, qpu, qubit_pairs, *, length_cliffords, variations=1, seed=None, gate_map=None, temporary_parameters=None, options=None)
¶
The Randomized Benchmarking Workflow for two-qubit pairs.
The workflow consists of the following steps:
- generate_clifford_sequences
- flatten_qubit_pairs
- create_experiment
- compile_experiment
- run_experiment
- analysis_workflow
Changed in version 27.1.0
The experiment moved out of contrib and no longer needs Qiskit.
- Each pair plays its own random Clifford sequences, so the pairs must not share qubits.
- The same
seedgives different sequences than before. gate_mapaccepts only the gatessx,xandrzand one two-qubit gate,cz,cxoriswap.- The experiment supports only the ge transition, and only single-shot,
discriminated data: the
averaging_modeandacquisition_typeoptions must beSINGLE_SHOTandDISCRIMINATION. - It resets the qubits actively before every sequence when the
active_resetoption is set. - The tasks take the qubit pairs as UIDs.
create_tq_rb_qasmis now generate_clifford_sequences, andresolve_qubit_pairs,get_gate_mapandadd_qasm_operationsare gone.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
The connected session to use for running the experiment. |
required |
qpu
|
QPU
|
The qpu consisting of the original qubits and quantum operations. |
required |
qubit_pairs
|
list[list[str]]
|
List of [q0, q1] qubit pairs to run the experiments on, passed by UID. The pairs must not share qubits. |
required |
length_cliffords
|
list[int]
|
List of numbers of 2-qubit Clifford gates to sweep. |
required |
variations
|
int
|
Number of random seeds for RB. |
1
|
seed
|
int | None
|
The seed of the random sequences. The sequences of a pair depend only on the seed and the UIDs of its qubits. Default is None and provides a random seed. |
None
|
gate_map
|
dict | None
|
Maps the native gates |
None
|
temporary_parameters
|
dict[str, dict | QuantumParameters] | None
|
The temporary QPU parameters. |
None
|
options
|
TuneUpWorkflowOptions | None
|
The options for building the workflow. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
WorkflowBuilder |
None
|
The builder for the experiment workflow. |
Example
options = experiment_workflow.options()
options.count(10)
# QPU from a two-qubit device setup
qpu = QPU(
quantum_elements=TunableTransmonQubit.from_device_setup(setup),
quantum_operations=TunableTransmonOperations(),
)
result = experiment_workflow(
session=session,
qpu=qpu,
qubit_pairs=[["q0", "q1"]],
length_cliffords=[1, 5, 10, 20, 50],
variations=5,
options=options,
).run()
flatten_qubit_pairs(qpu, qubit_pairs)
¶
Returns the qubits of qubit_pairs and the elements on the edges between them.
create_experiment passes this list to @dsl.qubit_experiment, which
registers the signals of the qubits and of the couplers that the two-qubit
gates drive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qpu
|
QPU
|
The QPU, whose topology holds the edges between the qubits. |
required |
qubit_pairs
|
list[list[str]]
|
List of [q0, q1] pairs, passed by UID. |
required |
Returns:
| Type | Description |
|---|---|
list[QuantumElement]
|
The qubits of all pairs, each followed by the quantum elements on the
edges between them, without duplicates:
|
generate_clifford_sequences(qubit_pairs, length_cliffords, gate_map=None, variations=1, seed=None)
¶
Creates the two-qubit RB Clifford sequences of each pair as lists of gates.
Each sequence draws its two-qubit Cliffords uniformly at random and ends with
the Clifford that inverts them. Each Clifford takes the fewest two-qubit gates,
then the fewest pulses, that the gates of gate_map allow. Every pair gets its own
sequences.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qubit_pairs
|
list[list[str]]
|
List of [q0, q1] pairs to create the sequences for, passed by UID. |
required |
length_cliffords
|
list
|
A list of RB sequence lengths (number of 2-qubit Cliffords). |
required |
gate_map
|
dict | None
|
Maps the native gates |
None
|
variations
|
int
|
Number of random sequences per sequence length. |
1
|
seed
|
int | None
|
The seed of the random sequences. The sequences of a pair depend only on the seed and the UIDs of its qubits. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, tuple[list[tuple], ...]]
|
A dictionary of Clifford sequences, keyed by |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |