# Example: Comparing Infidelities with SRB and XRB

This example demonstrates how to estimate the process infidelities of specified systems using SRB, and how this quantity can be divided into coherent and stochastic infidelity by the addition of XRB circuits. While this example uses the built-in Simulator to execute the circuits, the same procedure can be followed for hardware applications.

[2]:

import trueq as tq

# generate SRB circuits to simultaneously characterize a single qubit [0],
# a pair of qubits [1, 2], and another single qubit [3]
circuits = tq.make_srb([[0], [1, 2], [3]], [2, 4, 16], 30)

# generate XRB circuits using the same arguments as SRB and combine them
circuits += tq.make_xrb([[0], [1, 2], [3]], [2, 4, 16], 30)

# initialize a noisy simulator with stochastic Pauli and overrotation

# run the circuits on the simulator to populate their results
sim.run(circuits, n_shots=1000)

# print the fit summary
circuits.fit()

[2]:

True-Q formatting will not be loaded without trusting this notebook or rerunning the affected cells. Notebooks can be marked as trusted by clicking "File -> Trust Notebook".
 SRB Streamlined Randomized Benchmarking Cliffords (0,) Key: labels: (0,) protocol: SRB twirl: Cliffords on [0, (1, 2), 3] Cliffords (1, 2) Key: labels: (1, 2) protocol: SRB twirl: Cliffords on [0, (1, 2), 3] Cliffords (3,) Key: labels: (3,) protocol: SRB twirl: Cliffords on [0, (1, 2), 3] ${e}_{F}$ The probability of an error acting on the targeted systems during a random gate. 2.4e-02 (1.1e-03) 0.023556748637931058, 0.0010654710463941176 3.7e-02 (1.4e-03) 0.03656024950541466, 0.0013717784886823814 2.2e-02 (1.1e-03) 0.021711383785875227, 0.0010657983862686568 ${p}$ Decay parameter of the exponential decay $Ap^m$. 9.7e-01 (1.4e-03) 0.9685910018160919, 0.0014206280618588236 9.6e-01 (1.5e-03) 0.9610024005275577, 0.0014632303879278735 9.7e-01 (1.4e-03) 0.9710514882854997, 0.0014210645150248757 ${A}$ SPAM parameter of the exponential decay $Ap^m$. 9.6e-01 (7.8e-03) 0.9562930530359697, 0.007844258840488227 9.1e-01 (8.6e-03) 0.9094093792058071, 0.008559762817685446 9.6e-01 (6.8e-03) 0.9570237811983572, 0.006773839235629938 XRB Extended Randomized Benchmarking Cliffords (0,) Key: labels: (0,) protocol: XRB twirl: Cliffords on [0, (1, 2), 3] Cliffords (1, 2) Key: labels: (1, 2) protocol: XRB twirl: Cliffords on [0, (1, 2), 3] Cliffords (3,) Key: labels: (3,) protocol: XRB twirl: Cliffords on [0, (1, 2), 3] ${e}_{U}$ The process infidelity of the coherent error acting on the specifed systems during a random gate. 4.1e-03 (1.3e-03) 0.004094186256904775, 0.001287370167317735 -2.3e-03 (1.6e-03) -0.0023007092006731983, 0.001594211197310081 4.1e-03 (1.4e-03) 0.004142416830879236, 0.001385406402948233 ${e}_{S}$ The probability of a stochastic error acting on the specified systems during a random gate. 1.9e-02 (7.2e-04) 0.019462562381026283, 0.0007225603068225637 3.9e-02 (8.1e-04) 0.038860958706087856, 0.0008122395703344695 1.8e-02 (8.9e-04) 0.01756896695499599, 0.0008851128183215341 ${u}$ The unitarity of the noise, that is, the average decrease in the purity of an initial state. 9.5e-01 (1.9e-03) 0.948604888763177, 0.0018893264847386028 9.2e-01 (1.7e-03) 0.9187074738126725, 0.0016654403454554692 9.5e-01 (2.3e-03) 0.9535609795864983, 0.002318832801239999 ${A}$ SPAM parameter of the exponential decay $Au^m$. 9.7e-01 (1.1e-02) 0.970192604712159, 0.01055894933331665 9.8e-01 (9.5e-03) 0.9824863232147655, 0.009511127071994854 9.5e-01 (1.1e-02) 0.953622247859911, 0.011428970408491312

Notice that the fit() output contains an estimate of process infidelity for the specified systems from SRB, the stochastic infidelity from XRB, and the unitary infidelity which would be absent if the circuit collection did not contain both SRB and XRB circuits. We can visualize the different process infidelities as follows.

[3]:

# plot a comparison of process infidelities
circuits.plot.compare_rb()