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

Add comp_basis_encoder to models.encodings #1165

Merged
merged 14 commits into from
Feb 2, 2024
20 changes: 20 additions & 0 deletions doc/source/api-reference/qibo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,26 @@ We provide a family of algorithms that encode classical data into quantum circui
Computational Basis Encoder
"""""""""""""""""""""""""""

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a couple of words about this and the other encoders we already have? I remember I was trying to use them some time ago but I had a hard time understanding how to use them. A small example of how to encode data into circuits might help.

Given a bitstring :math:`b` of length :math:`n`, this encoder generates of a layer of Pauli-:math:`X``
renatomello marked this conversation as resolved.
Show resolved Hide resolved
gates that creates the quantum state :math:`|\,b\,\rangle`.

For instance, the following two circuit generations are equivalent:

.. testsetup::

from qibo import Circuit, gates
from qibo.models.encodings import comp_basis_encoder

.. testcode::

b = "101"
circuit_1 = comp_basis_encoder(b)

circuit_2 = Circuit(3)
circuit_2.add(gates.X(0))
circuit_2.add(gates.X(2))


.. autofunction:: qibo.models.encodings.comp_basis_encoder


Expand Down
Loading