supermarq.qcvv.irb

Tooling for interleaved randomised benchmarking

Classes

IRB

Interleaved random benchmarking (IRB) experiment.

IRBResults

Data structure for the IRB experiment results.

RBResults

Data structure for the RB experiment results.

Module Contents

class supermarq.qcvv.irb.IRB(interleaved_gate: cirq.Gate | None = cirq.Z, num_qubits: int | None = 1, clifford_op_gateset: cirq.CompilationTargetGateset = cirq.CZTargetGateset(), *, random_seed: int | numpy.random.Generator | None = None)

Bases: supermarq.qcvv.base_experiment.BenchmarkingExperiment[Union[IRBResults, RBResults]]

Interleaved random benchmarking (IRB) experiment.

IRB estimates the gate error of specified Clifford gate, \(\mathcal{C}^*\). This is achieved by first choosing a random sequence, \(\{\mathcal{C_i}\}_m\) of \(m\) Clifford gates and then using this to generate two circuits. The first is generated by appending to this sequence the single gate that corresponds to the inverse of the original sequence. The second circuit it obtained by inserting the interleaving gate, \(\mathcal{C}^*\) after each gate in the sequence and then again appending the corresponding inverse element of the new circuit. Thus both circuits correspond to the identity operation.

We run both circuits on the specified target and calculate the probability of measuring the resulting state in the ground state, \(p(0...0)\). This gives the circuit fidelity

\[f(m) = 2p(0...0) - 1\]

We can then fit an exponential decay \(\log(f) \sim m\) to this circuit fidelity for each circuit, with decay rates \(\alpha\) and \(\tilde{\alpha}\) for the circuit without and with interleaving respectively. Finally the gate error of the specified gate, \(\mathcal{C}^*\) is estimated as

\[e_{\mathcal{C}^*} = \frac{1}{2} \left(1 - \frac{\tilde{\alpha}}{\alpha}\right)\]

For more details see: https://arxiv.org/abs/1203.4550

analyze_results(plot_results: bool = True) IRBResults | RBResults

Analyse the experiment results and estimate the interleaved gate error.

Parameters:

plot_results – Whether to generate plots of the results. Defaults to False.

Returns:

A named tuple of the final results from the experiment.

static exp_decay(x: numpy.typing.NDArray[numpy.float_], A: float, alpha: float, B: float) numpy.typing.NDArray[numpy.float_]

Exponential decay of the form

\[A \alpha^x + B\]
Parameters:
  • x – x

  • A – Decay constant

  • alpha – Decay coefficient

  • B – Additive constant

Returns:

Exponential decay applied to x.

gates_per_clifford(samples: int = 500) dict[str, float]

Samples a number of random Clifford operations and calculates the average number of single and two qubit gates used to implement them. Note this depends on the gateset chosen for the experiment.

Parameters:

samples – Number of samples to use. Defaults to 500.

Returns:

A dictionary with the average number of one and two qubit gates used.

plot_results() None

Plot the exponential decay of the circuit fidelity with cycle depth.

random_clifford() cirq.CliffordGate

Returns: A random clifford gate with the correct number of qubits for the current experiment.

random_single_qubit_clifford() cirq.SingleQubitCliffordGate

Choose a random single qubit clifford gate.

Returns:

The random clifford gate.

random_two_qubit_clifford() cirq.CliffordGate

Choose a random two qubit clifford gate.

For algorithm details see https://arxiv.org/pdf/1402.4848 & https://arxiv.org/pdf/1210.7011.

Returns:

The random clifford gate.

clifford_op_gateset

The gateset to use when implementing Clifford operations.

class supermarq.qcvv.irb.IRBResults

Bases: supermarq.qcvv.base_experiment.BenchmarkingResults

Data structure for the IRB experiment results.

average_interleaved_gate_error: float | None

Estimate of the interleaving gate error.

average_interleaved_gate_error_std: float | None

Standard deviation of the estimate for the interleaving gate error.

experiment_name = 'IRB'

The name of the experiment.

irb_decay_coefficient: float | None

Decay coefficient estimate with the interleaving gate.

irb_decay_coefficient_std: float | None

Standard deviation of the decay coefficient estimate with the interleaving gate.

rb_decay_coefficient: float

Decay coefficient estimate without the interleaving gate.

rb_decay_coefficient_std: float

Standard deviation of the decay coefficient estimate without the interleaving gate.

class supermarq.qcvv.irb.RBResults

Bases: supermarq.qcvv.base_experiment.BenchmarkingResults

Data structure for the RB experiment results.

average_error_per_clifford: float | None

Estimate of the average error per Clifford operation.

average_error_per_clifford_std: float | None

Standard deviation of the the average error per Clifford operation.

experiment_name = 'RB'

The name of the experiment.

rb_decay_coefficient: float

Decay coefficient estimate without the interleaving gate.

rb_decay_coefficient_std: float

Standard deviation of the decay coefficient estimate without the interleaving gate.