Skip to content

laboneq_applications.experiments.two_qubit_irb

This module defines a two-qubit interleaved randomized benchmarking experiment.

In this experiment, every random sequence of two-qubit Clifford gates is played twice: as it is, and with the interleaved gate after every Clifford. Each sequence ends with the recovery gate that returns the qubits to |00⟩ for perfect gates. Comparing the decays of the two kinds of sequences gives the error of the interleaved gate.

The experiment has the following pulse sequences, for every variation and length:

q0, q1 --- [ clifford sequence ] --- [ recovery gate ] --- [ measure ]
q0, q1 --- [ clifford sequence w/ interleaved gate ] --- [ 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.

InterleavedGateOptions

Options for the tasks that need to know the interleaved gate.

Attributes:

Name Type Description
interleaved_gate Literal['iswap', 'cz', 'cx']

The gate to interleave within the RB sequences. A quantum operation of the same name must implement it, unless gate_map names another one, and the QPU needs an edge of the same tag between the qubits of every pair. Can be one of:

  • "iswap"
  • "cz"
  • "cx"

With cx, the sequences return to |00⟩ only if rz(θ) implements exp(-iθZ/2) and sx implements exp(-iπX/4), or both implement the inverses, and if cx takes its control qubit first. With cz and iswap, the directions of these rotations do not matter.

Default: "cz"

experiment_workflow(session, qpu, qubit_pairs, *, length_cliffords, variations=1, seed=None, gate_map=None, temporary_parameters=None, options=None)

The IRB Workflow for two qubits coupled by a tunable coupler.

The workflow consists of the following steps:

Changed in version 27.1.0

The experiment moved out of contrib and no longer needs Qiskit.

  • The workflow is named two_qubit_irb instead of two_qubit_coupler_irb and takes TuneUpWorkflowOptions instead of TwoQubitCouplerIRBWorkflowOptions.
  • It plays every pair passed instead of only the first, each with its own random Clifford sequences, so the pairs must not share qubits.
  • All arguments apart from session, qpu and qubit_pairs are keyword arguments, and seed is new.
  • gate_map replaces the default gate map instead of extending it.
  • It creates its experiment with the create_experiment task of the two-qubit RB experiment, and resets the qubits actively when the active_reset option is set instead of add_reset.
  • It takes single-shot, discriminated data by default, and raises an error for other values of the averaging_mode and acquisition_type options.
  • create_irb_sequences is now generate_irb_sequences, and create_qasm_qubit_map, register_qasm_operations, create_qasm_batch_experiment and MultiQASMProgramOptions are 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, tunable couplers and quantum operations.

required
qubit_pairs list[list[str]]

The pairs of qubits to run the experiments on. Each pair must be a list of two qubit UIDs.

required
length_cliffords list[int]

List of the numbers of Clifford gates to sweep.

required
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. Default is None and provides a random seed.

None
gate_map dict | None

Maps the native gates sx, x, rz and the interleaved gate to the quantum operations that implement them. Needs sx, rz and the interleaved gate; x is optional. With the interleaved gate cx, the operations must follow the conventions that InterleavedGateOptions states. Default: {"sx": "x90", "x": "x180", "rz": "rz"}, with the interleaved gate mapped to the operation of the same name.

None
temporary_parameters dict[str, dict | QuantumParameters] | None

The temporary parameters with which to update the qubit-pair parameters for the duration of the experiment.

None
options TuneUpWorkflowOptions | None

The options for building the workflow, passed as an instance of TuneUpWorkflowOptions. In addition to options from WorkflowOptions, the following custom options are supported:

  • validate_interleaved_gate_edges and generate_irb_sequences: The options for the interleaved gate, as an instance of InterleavedGateOptions.
  • create_experiment: The options for creating the experiment, as an instance of TwoQubitRBExperimentOptions.
None

Returns:

Name Type Description
result None

The result of the workflow.

Example
options = experiment_workflow.options()
options.count(10)
options.interleaved_gate("iswap")
result = experiment_workflow(
    session=session,
    qpu=qpu,
    qubit_pairs=[["q0", "q1"]],
    length_cliffords=[1, 5, 10, 20, 50],
    variations=5,
    options=options,
).run()

generate_irb_sequences(qubit_pairs, length_cliffords, variations=1, gate_map=None, seed=None, options=None)

Creates the standard and interleaved RB sequences of each pair as gates.

For every variation and length, draws one sequence of uniformly random two-qubit Cliffords and returns it twice: as it is, and with the interleaved gate after every Clifford. Both sequences end with the Clifford that inverts them. Each Clifford takes the fewest interleaved 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
variations int

Number of random sequences per sequence length.

1
gate_map dict | None

Maps the native gates sx, x, rz and the interleaved gate to the quantum operations that implement them. Needs sx, rz and the interleaved gate; x is optional. With the interleaved gate cx, the operations must follow the conventions that InterleavedGateOptions states. Default: {"sx": "x90", "x": "x180", "rz": "rz"}, with the interleaved gate mapped to the operation of the same name.

None
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
options InterleavedGateOptions | None

The options for this task, passed as an instance of InterleavedGateOptions.

None

Returns:

Type Description
dict[str, tuple[list[tuple], ...]]

A dictionary of Clifford sequences, keyed by "q0_uid-q1_uid". Each sequence is a list of (operation, qubits, *parameters) gates, where operation is the name of a quantum operation and qubits holds the positions in the pair of the qubits it acts on. A pair has a standard and then an interleaved sequence per variation and length, ordered by variation and then by length: for length_cliffords=[1, 5] and variations=2, the lengths are 1, 1, 5, 5, 1, 1, 5, 5.

Raises:

Type Description
ValueError

If gate_map names a gate other than sx, x, rz and the interleaved gate, or lacks sx, rz or the interleaved gate.

validate_interleaved_gate_edges(qpu, qubit_pairs, options=None)

Checks that every pair has a flux-driven edge for the interleaved gate.

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
options InterleavedGateOptions | None

The options for this task, passed as an instance of InterleavedGateOptions.

None

Raises:

Type Description
KeyError

If a pair has no edge tagged with the interleaved gate.

ValueError

If the quantum element of an edge has no flux line.