# Cycle Benchmarking (CB)¶

Cycle benchmarking^{a} (CB) is a breakthrough new capability to efficiently estimate
the holistic and full impact of all local and global error rates from all relevant error
mechanisms including error correlations and cross-talk (see [2]) for any
parallel set of quantum operations over an \(n\)-qubit quantum processor. CB is a
completely scalable protocol that also enables Pauli Error Reconstruction for developing
a detailed understanding of the leading error mechanisms that limit system performance.
A simplified version of CB for Clifford gates is illustrated below.

^{a} Patent pending.

## Example¶

```
#
# Cycle benchmarking (CB) example.
# Copyright 2019 Quantum Benchmark Inc.
#
import trueq as tq
# Define a cycle that we want to benchmark.
cycle = {(0,): tq.Gate.x, (1, 2): tq.Gate.cz}
# Generate a circuit collection to run CB on the above cycle with 30 random circuits
# for each circuit length in [4, 32, 64] and 6 randomly chosen pauli decay strings.
# Note that, typically, at least 20 pauli_decays should be used; we used 6 here
# to make the example run faster.
circuits = tq.make_cb(cycle, [4, 12, 32], 30, 6)
# Initialize a simulator with stochastic pauli noise.
sim = tq.Simulator().add_stochastic_pauli(px=0.01)
# Run the circuits on the simulator to populate the results.
sim.run(circuits)
# Plot the results.
circuits.plot.raw(labels=[[0, 1, 2]])
# Print summary of the results.
circuits.fit(labels=[[0, 1, 2]]).summarize()
```

The output parameters of this protocol are displayed below.
When the circuits were generated, six random 3-qubit paulis were chosen as
representatives, and the rate of decay of each was measured; these decay rates
are reported.
However, the parameter of interest is the composite parameter `r`

, which is an
estimate of the average gate infidelity infidelity of the entire cycle.

```
CB on [0, 1, 2]
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
r 6.760 [5.333,8.188] e-02 Process infidelity of the noise map
CB on [0, 1, 2] with decay IIY
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
A 1.020 [0.976,1.065] SPAM of the exponential decay A * p ** m
p 0.936 [0.929,0.943] Decay rate of the exponential decay A * p ** m
CB on [0, 1, 2] with decay XII
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
A 0.976 [0.966,0.986] SPAM of the exponential decay A * p ** m
p 1.000 [0.999,1.001] Decay rate of the exponential decay A * p ** m
CB on [0, 1, 2] with decay YYZ
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
A 0.954 [0.834,1.074] SPAM of the exponential decay A * p ** m
p 0.906 [0.886,0.925] Decay rate of the exponential decay A * p ** m
CB on [0, 1, 2] with decay ZIY
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
A 0.941 [0.833,1.049] SPAM of the exponential decay A * p ** m
p 0.908 [0.888,0.927] Decay rate of the exponential decay A * p ** m
CB on [0, 1, 2] with decay ZXX
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
A 0.893 [0.812,0.974] SPAM of the exponential decay A * p ** m
p 0.927 [0.914,0.940] Decay rate of the exponential decay A * p ** m
CB on [0, 1, 2] with decay ZYI
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
A 0.856 [0.767,0.944] SPAM of the exponential decay A * p ** m
p 0.918 [0.902,0.933] Decay rate of the exponential decay A * p ** m
```