Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version

qiskit.ignis.verification.calculate_2q_epc

calculate_2q_epc(gate_per_cliff, epg_2q, qubit_pair, list_epgs_1q, two_qubit_name='cx')

GitHub(opens in a new tab)

Convert error per gate (EPG) into error per Clifford (EPC) of two qubit cx gates.

Given that we know the number of gates per Clifford NiN_i and those EPGs, we can predict EPC of that RB sequence:

EPC=1i(1EPGi)NiEPC = 1 - \prod_i \left( 1 - EPG_i \right)^{N_i}

This function isolates the contribution of two qubit gate to the EPC [1]. This will give you more accurate estimation of EPC, especially when the cx gate fidelity is close to that of single qubit gate. To run this function, you need to know EPG of both single and two qubit gates. For example, when you prepare 2Q RB experiment with appropriate error model, you can define EPG of those basis gate set. Then you can estimate the EPC of prepared RB sequence without running experiment.

import qiskit.ignis.verification.randomized_benchmarking as rb
 
# gate counts of your 2Q RB experiment
gpc = {0: {'cx': 1.49, 'u1': 0.25, 'u2': 0.95, 'u3': 0.56},
       1: {'cx': 1.49, 'u1': 0.24, 'u2': 0.98, 'u3': 0.49}}
 
# EPGs from error model
epgs_q0 = {'u1': 0, 'u2': 0.001, 'u3': 0.002}
epgs_q1 = {'u1': 0, 'u2': 0.002, 'u3': 0.004}
epg_q01 = 0.03
 
# calculate 2Q EPC
epc_2q = rb.rb_utils.calculate_2q_epc(
    gate_per_cliff=gpc,
    epg_2q=epg_q01,
    qubit_pair=[0, 1],
    list_epgs_1q=[epgs_q0, epgs_q1])
 
# calculate EPC according to the definition
fid = 1
for qubit in (0, 1):
    for epgs in (epgs_q0, epgs_q1):
        for gate, val in epgs.items():
            fid *= (1 - val) ** gpc[qubit][gate]
fid *= (1 - epg_q01) ** 1.49
epc = 1 - fid
 
print('Total sequence EPC: %f, 2Q gate contribution: %f' % (epc, epc_2q))
Total sequence EPC: 0.055868, 2Q gate contribution: 0.051004

As you can see two qubit gate contribution is dominant in this RB sequence.

References

[1] D. C. McKay, S. Sheldon, J. A. Smolin, J. M. Chow, and J. M. Gambetta, “Three-Qubit Randomized Benchmarking,” Phys. Rev. Lett., vol. 122, no. 20, 2019 (arxiv:1712.06550).

Parameters

  • gate_per_cliff (Dict[int, Dict[str, float]]) – dictionary of gate per Clifford. see gates_per_clifford().
  • epg_2q (float) – EPG estimated by error model.
  • qubit_pair (List[int]) – index of two qubits to calculate EPC.
  • list_epgs_1q (List[Dict[str, float]]) – list of single qubit EPGs of qubit listed in qubit_pair.
  • two_qubit_name (Optional[str]) – name of two qubit gate in basis gates.

Return type

float

Returns

EPG of 2Q gate.

Raises

QiskitError – when cx is not found, specified qubit_pair is not included in the gate count dictionary, or length of qubit_pair is not 2.

Was this page helpful?
Report a bug or request content on GitHub.