Skip to content

Commit

Permalink
Update qibo.rst
Browse files Browse the repository at this point in the history
testcode always runs into error (DepolarizingError is not defined). Combining testsetup into testcode to resolve the errors.
  • Loading branch information
mho291 authored Feb 16, 2024
1 parent 317ed69 commit da539f4
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions doc/source/api-reference/qibo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2254,10 +2254,9 @@ The gate set tomography (GST) follows the procedure outlined in https://arxiv.or
Single qubit example
^^^^^^^^^^^^^^^^^^^^

Suppose we have a single qubit quantum circuit and we want to perform probabilistic error cancellation on this circuit. We will need to do gate set tomography for a single qubit quantum circuit and all its gates individually first. Consider an example where our quantum circuit contains the Hadamard gate and an RX gate, here is how we do gate set tomography using the function ``execute_GST()`` for both gates individually and also without any operator for calibration.
Suppose we have a single qubit quantum circuit and we want to perform probabilistic error cancellation on this circuit. We will need to do gate set tomography for a single qubit quantum circuit and all its gates individually first. Consider an example where our quantum circuit contains the Hadamard gate and an RX gate, here is how we do gate set tomography using the function ``execute_GST()`` for both gates individually and also without any operator for calibration. We import depolarizing noise as an example.

First, import the necessary modules. We import depolarizing noise as an example.
.. testsetup::
.. testcode::

import qibo
from qibo import models
Expand All @@ -2266,8 +2265,6 @@ First, import the necessary modules. We import depolarizing noise as an example.
from qibo.noise import DepolarizingError
from qibo.tomography.gate_set_tomography import *

.. testcode::

# Create the single qubit quantum circuit
circuit = models.Circuit(1)
circuit.add(gates.H(0))
Expand Down Expand Up @@ -2311,20 +2308,16 @@ For this single qubit gate set tomography, the outputs given by ``GST_empty_1qb`
Two qubits example
^^^^^^^^^^^^^^^^^^

As another example, suppose we have a two qubit quantum circuit that generates a Bell state. Here is how we do gate set tomography using the function``execute_GST()`` for the Hadamard gate, the CNOT gate, and without any operator (both single qubit and two-qubit) for calibration. We will need to calibrate an empty single qubit circuit and an empty two-qubit circuit as the Hadamard gate is a single qubit gate and the CNOT is a two-qubit gate. This will become relevant when doing probabilistic error cancellation.

First, again, import the necessary modules. We import depolarizing noise as an example.
.. testsetup::
As another example, suppose we have a two qubit quantum circuit that generates a Bell state. Here is how we do gate set tomography using the function``execute_GST()`` for the Hadamard gate, the CNOT gate, and without any operator (both single qubit and two-qubit) for calibration. We will need to calibrate an empty single qubit circuit and an empty two-qubit circuit as the Hadamard gate is a single qubit gate and the CNOT is a two-qubit gate. This will become relevant when doing probabilistic error cancellation. We import depolarizing noise as an example.

.. testcode::
import qibo
from qibo import models
from qibo import gates
from qibo.noise import NoiseModel
from qibo.noise import DepolarizingError
from qibo.tomography.gate_set_tomography import *

.. testcode::

# Create the two qubit quantum circuit
circuit = qibo.models.Circuit(2)
circuit.add(gates.H(0))
Expand Down

0 comments on commit da539f4

Please sign in to comment.