qermit.probabilistic_error_cancellation — Qermit 0.2.0 documentation

# qermit.probabilistic_error_cancellation

pec_learning_based.gen_PEC_learning_based_MitEx(simulator_backend: pytket.backends.backend.Backend, **kwargs) → qermit.taskgraph.mitex.MitEx

  Generates MitEx object for mitigating errors using learning based Probabilistic Error Cancellation (PEC), as introduced in https://arxiv.org/abs/2005.07601.

  Parameters

    - device_backend (Backend) – Noisy backend on which circuits are to be run.

    - simulator_backend (Backend) – Ideal state vector simulator used for simulating Clifford Circuits.

  Key simulator_mitex

    MitEx object ideal state simulations are run on, default simulator_backend.

  Key device_mitex

    MitEx object observable experiments are run on, default device_backend.

  Key seed

    Seed for np.random, default None.

  Key optimisation_level

    Optimisation level for initial compilation, default 0.

  Key num_cliff

    The number of random Clifford circuits generated for each primary circuit, default 10.

  Raises

    RuntimeError – Raised if the backend gate set does not include CX or CZ gates.

  Returns

    MitEx object implementing error-mitigation via learning based PEC.

  Return type

    MitEx

pec_learning_based.gen_rebase_to_frames_and_computing() → qermit.taskgraph.mittask.MitTask

  Generates task which rebases circuits into the Frame and Computing gate set, as defined in https://arxiv.org/abs/2005.07601. In particular, all two qubit gates are Clifford gates (called Frame gates), and all single qubit gates (called Computing gates) are merged where possible.

  Returns

    MitTask object which rebases circuits into the Frame and Computing gate set.

  Return type

    MitTask

pec_learning_based.gen_run_with_quasi_prob() → qermit.taskgraph.mittask.MitTask

  Generates task which converts list of quasi probabilities and noisy circuit results into error mitigated results.

  Returns

    MitTask performing mitigation given noisy results and quasi-probabilities.

  Return type

    MitTask

pec_learning_based.collate_results_task_gen() → qermit.taskgraph.mittask.MitTask

  Generates task which collates results from running circuit, and circuits with frame gates wrapped in Pauli gates. The results are collated so as to facilitate learning the quasiprobabilities required for correction. The data itself is not changed by this task.

  Returns

    MitTask object collating results.

  Return type

    MitTask

pec_learning_based.learn_quasi_probs_task_gen() → qermit.taskgraph.mittask.MitTask

  Generates task which characterises quasi-probabilities. This takes ideal simulation results (from running Clifford circuit) and noisy results, and uses them to deduce quasi-probabilities for later correction of real experiment results.

  Parameters

    num_cliff_circ (int) – The number of Clifford circuits generated for each inputted circuit.

  Returns

    MitTask object for producing quasi probabilities.

  Return type

    MitTask

pec_learning_based.gen_get_clifford_training_set(num_rand_cliff: int) → qermit.taskgraph.mittask.MitTask

  Generates task which creates characterisation Clifford circuits. These circuits are constructed from an initial circuit by replacing all Computing gates with random Clifford gates.

  Parameters

    - simulator_backend (Backend) – Ideal simulator backend on which Clifford circuits are to be run.

    - num_rand_cliff (int) – Number of random Clifford circuits for each fixed ObservableExperiment.

  Returns

    MitTask object for producing random Clifford circuits.

  Return type

    MitTask

pec_learning_based.gen_label_gates() → qermit.taskgraph.mittask.MitTask

  Generates task which labels all gates as either Computing or Frame. Frame gates are 2-qubit Clifford gates and Computing gates are single qubit gates. Circuits should be rebased to Frame and Computing before this task.

  Returns

    MitTask performing labelling of gates.

  Return type

    MitTask

pec_learning_based.gen_wrap_frame_gates() → qermit.taskgraph.mittask.MitTask

  Generates task which wraps Frame gates in Pauli gates, initially set to the identity. Pauli gates are labelled as such.

  Returns

    MitTask which performs wrapping.

  Return type

    MitTask

pec_learning_based.gen_get_noisy_circuits(**kwargs) → qermit.taskgraph.mittask.MitTask

  Generates task which create list of circuts, build from original by adding an error to one of the Frame gates. An error here is recreated by replacing a pair of Pauli gates, wrapped around one Frame gate, by a Pauli gate. Note that there will be a new circuit for each possible Pauli error.

  Parameters

    backend (Backend) – Backend on which circuits will be run. Required for compilation.

  Returns

    MitTask produsing noisy gates.

  Return type

    MitTask