# Randomized Benchmarking¶

## RandomizedBenchmarkingModel - Likelihood for RB experiments¶

### Class Reference¶

class qinfer.RandomizedBenchmarkingModel(interleaved=False, order=0)[source]

Bases: qinfer.abstract_model.FiniteOutcomeModel, qinfer.abstract_model.DifferentiableModel

Implements the randomized benchmarking or interleaved randomized benchmarking protocol, such that the depolarizing strength $$p$$ of the twirled channel is a parameter to be estimated, given a sequnce length $$m$$ as an experimental control. In addition, the zeroth-order “fitting”-parameters $$A$$ and $$B$$ are represented as model parameters to be estimated.

Parameters: Model Parameters: interleaved (bool) – If True, the model implements the interleaved protocol, with $$\tilde{p}$$ being the depolarizing parameter for the interleaved gate and with $$p_{\text{ref}}$$ being the reference parameter. p – Fidelity of the twirled error channel $$\Lambda$$, represented as a decay rate $$p = (d F - 1) / (d - 1)$$, where $$F$$ is the fidelity and $$d$$ is the dimension of the Hilbert space. A – Scale of the randomized benchmarking decay, defined as $$\Tr[Q \Lambda(\rho - \ident / d)]$$, where $$Q$$ is the final measurement, and where $$\ident$$ is the initial preparation. B – Offset of the randomized benchmarking decay, defined as $$\Tr[Q \Lambda(\ident / d)]$$. m (int) – Length of the randomized benchmarking sequence that was measured.
n_modelparams
modelparam_names
is_n_outcomes_constant
expparams_dtype
n_outcomes(expparams)[source]
are_models_valid(modelparams)[source]
likelihood(outcomes, modelparams, expparams)[source]
score(outcomes, modelparams, expparams, return_L=False)[source]

### Function Reference¶

qinfer.rb.p(F, d=2)[source]

Given the fidelity of a gate in $$d$$ dimensions, returns the depolarizating probability of the twirled channel.

Parameters: F (float) – Fidelity of a gate. d (int) – Dimensionality of the Hilbert space on which the gate acts.
qinfer.rb.F(p, d=2)[source]

Given the depolarizating probabilty of a twirled channel in $$d$$ dimensions, returns the fidelity of the original gate.

Parameters: p (float) – Depolarizing parameter for the twirled channel. d (int) – Dimensionality of the Hilbert space on which the gate acts.