Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving documentation of models.encodings.entangling_layer #1273

Merged
merged 11 commits into from
Mar 22, 2024
Binary file added doc/source/_static/entangling_layer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 28 additions & 12 deletions doc/source/api-reference/qibo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,8 @@ For instance, the following two circuit generations are equivalent:


.. image:: ../_static/comp_basis_encoder.png
:width: 3400px
:height: 2000px
:scale: 25 %
:width: 400
:height: 250
:align: center


Expand Down Expand Up @@ -307,9 +306,8 @@ For instance, the following two circuit generations are equivalent:


.. image:: ../_static/phase_encoder.png
:width: 1333px
:height: 1552px
:scale: 30 %
:width: 300
:height: 300
:align: center


Expand Down Expand Up @@ -346,9 +344,8 @@ For example, to encode a :math:`8`-dimensional data, one could use the so-called
*tree* architechture below:

.. image:: ../_static/unary_encoder_tree.png
:width: 1333px
:height: 1552px
:scale: 30 %
:width: 400
:height: 500
:align: center

where the first gate is the :class:`qibo.gates.X`
Expand All @@ -361,9 +358,8 @@ On the other hand, the same encoding could be performed using the so-called
*diagonal* (also known as *ladder*) architecture below:

.. image:: ../_static/unary_encoder_ladder.png
:width: 1867px
:height: 1552px
:scale: 30 %
:width: 700
:height: 550
:align: center

This architecture leads to a choice of angles based on
Expand All @@ -390,6 +386,25 @@ Entangling layer
""""""""""""""""

Generates a layer of nearest-neighbour two-qubit gates, assuming 1-dimensional connectivity.
With the exception of :class:`qibo.gates.gates.GeneralizedfSim`,
any of the two-qubit gates implemented in ``qibo`` can be selected to customize the entangling layer.
If the chosen gate is parametrized, all phases are set to :math:`0.0`.
Note that these phases can be updated a posterior by using
:meth:`qibo.models.Circuit.set_parameters`.
There are four possible choices of layer ``architecture``:
``diagonal``, ``shifted``, ``even-layer``, and ``odd-layer``.
For instance, we show below an example of each architecture for ``nqubits = 6``.


.. image:: ../_static/entangling_layer.png
:width: 800
:height: 450
:align: center


If ``closed_boundary`` is set to ``True``, then an extra gate is added connecting the last and the first qubit,
with the last qubit as the control qubit and the first qubit as a target qubit.


.. autofunction:: qibo.models.encodings.entangling_layer

Expand Down Expand Up @@ -1627,6 +1642,7 @@ We provide integration with the `stim <https://github.com/quantumlib/Stim>`_ pac
It is possible to run Clifford circuits using `stim` as an engine:

.. code-block:: python

from qibo.backends import CliffordBackend
from qibo.quantum_info import Clifford, random_clifford

Expand Down
Loading