# 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 3.769 [2.973,4.565] e-02 Process infidelity of the noise map
CB on [0, 1, 2] with decay IIX
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
A 0.999 [0.971,1.027] SPAM of the exponential decay A * p ** m
p 0.979 [0.976,0.982] Decay rate of the exponential decay A * p ** m
CB on [0, 1, 2] with decay IXI
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
A 0.989 [0.969,1.008] SPAM of the exponential decay A * p ** m
p 0.979 [0.977,0.981] Decay rate of the exponential decay A * p ** m
CB on [0, 1, 2] with decay IXX
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
A 0.980 [0.934,1.026] SPAM of the exponential decay A * p ** m
p 0.960 [0.954,0.965] Decay rate of the exponential decay A * p ** m
CB on [0, 1, 2] with decay IYY
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
A 0.957 [0.918,0.995] SPAM of the exponential decay A * p ** m
p 0.962 [0.957,0.967] Decay rate of the exponential decay A * p ** m
CB on [0, 1, 2] with decay IZZ
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
A 1.005 [0.897,1.113] SPAM of the exponential decay A * p ** m
p 0.911 [0.893,0.928] Decay rate of the exponential decay A * p ** m
CB on [0, 1, 2] with decay XXZ
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
A 0.914 [0.890,0.937] SPAM of the exponential decay A * p ** m
p 0.983 [0.981,0.986] Decay rate of the exponential decay A * p ** m
```