Randomized Benchmarking

Randomized benchmarking involves running long sequences of random Clifford group gates which compose to the identity to observe how performance degrades with increasing circuit depth.

do_rb(qc, benchmarker, qubit_groups, depths, …) A wrapper around experiment generation, data acquisition, and estimation that runs a RB experiment on the qubit_groups and returns the rb_decay along with the experiments and results.

Gates and Sequences

oneq_rb_gateset(qubit) Yield the gateset for 1-qubit randomized benchmarking.
twoq_rb_gateset(q1, q2) Yield the gateset for 2-qubit randomized benchmarking.
get_rb_gateset(qubits) A wrapper around the gateset generation functions.
generate_rb_sequence(benchmarker, qubits, …) Generate a complete randomized benchmarking sequence.
merge_sequences(sequences) Takes a list of equal-length “sequences” (lists of Programs) and merges them element-wise, returning the merged outcome.
generate_rb_experiment_sequences(…[, …]) Generate the sequences of Clifford gates necessary to run a randomized benchmarking experiment for a single (group of) qubit(s).
group_sequences_into_parallel_experiments(…) Consolidates randomized benchmarking sequences on separate groups of qubits into a flat list of ObservablesExperiments which merge parallel sets of distinct sequences.

Standard and Interleaved RB

generate_rb_experiments(benchmarker, …) Creates list of ObservablesExperiments which, when run in series, constitute a simultaneous randomized benchmarking experiment on the disjoint qubit_groups.
z_obs_stats_to_survival_statistics(…[, …]) Convert expectations of the dim - 1 observables which are the nontrivial combinations of tensor products of I and Z into survival mean and variance, where survival is the all zeros outcome.
fit_rb_results(depths, z_expectations, …) Fits the results of a standard RB or IRB experiment by converting expectations into survival probabilities (probability of measuring zero) and passing these on to the standard fit.

Unitarity or Purity RB

generate_unitarity_experiments(benchmarker, …) Creates list of ObservablesExperiments which, when run in series, constitute a simultaneous unitarity experiment on the disjoint qubit_groups.
estimate_purity(dim, op_expect, renorm) The renormalized, or ‘shifted’, purity is given in equation (10) of [ECN] where d is the dimension of the Hilbert space, 2**num_qubits
estimate_purity_err(dim, op_expect, …[, …]) Propagate the observed variance in operator expectation to an error estimate on the purity.
fit_unitarity_results(depths, expectations, …) Fits the results of a unitarity experiment by first calculating shifted purities and subsequently passing these on to the standard decay fit.
unitarity_to_rb_decay(unitarity, dimension) Converts a unitarity decay to a standard RB decay under the assumption that no unitary errors present.

Data Acquisition

acquire_rb_data(qc, experiments, num_shots, …) Runs each ObservablesExperiment and returns each group of resulting ExperimentResults
get_stats_by_qubit_group(qubit_groups, …) Organize the results of a simultaneous RB experiment into lists of expectations and std_errs for each sequence; these lists are stored in a dict for each qubit group.

Analysis Helper functions for RB

coherence_angle(rb_decay, unitarity) Equation 29 of [U+IRB]
gamma(irb_decay, unitarity) Corollary 5 of [U+IRB], second line
interleaved_gate_fidelity_bounds(irb_decay, …) Use observed rb_decay to place a bound on fidelity of a particular gate with given interleaved rb decay.
gate_error_to_irb_decay(irb_error, rb_decay, dim) For convenience, inversion of Eq.
irb_decay_to_gate_error(irb_decay, rb_decay, dim) Eq.
average_gate_error_to_rb_decay(gate_error, …) Inversion of eq.
rb_decay_to_gate_error(rb_decay, dimension) Eq.
unitarity_to_rb_decay(unitarity, dimension) Converts a unitarity decay to a standard RB decay under the assumption that no unitary errors present.
get_stats_by_qubit_group(qubit_groups, …) Organize the results of a simultaneous RB experiment into lists of expectations and std_errs for each sequence; these lists are stored in a dict for each qubit group.