Skip to content

Commit

Permalink
fix broken links
Browse files Browse the repository at this point in the history
  • Loading branch information
josh146 committed Oct 19, 2019
1 parent 0a07073 commit 96778fb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
26 changes: 13 additions & 13 deletions concepts/concept_embeddings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ A *quantum embedding* represents classical data as quantum states in a Hilbert s
feature map*. It takes a classical datapoint :math:`x` and translates it into a set of gate
parameters in a quantum circuit, creating a quantum state :math:`| \psi_x \rangle`. This process is
a crucial part of designing quantum algorithms and affects their computational power—for more
details, see :cite:`schuld2018supervised` and :cite:`schuld2018quantum`.
details, see :cite:`schuld2018supervised` and :cite:`schuld2018quantum`.

Let's consider classical input data consisting of :math:`M` examples, with :math:`N` features each,
Let's consider classical input data consisting of :math:`M` examples, with :math:`N` features each,

.. math:: \mathcal{D}=\{x^{(1)}, \ldots, x^{(m)}, \ldots, x^{(M)}\},

where :math:`x^{(m)}` is a :math:`N`-dimensional vector for :math:`m=1,\ldots,M`. To embed this data
into :math:`n` quantum subsystems (:math:`n` qubits *or* :math:`n` qumodes for discrete- and
continuous-variable quantum computing, respectively), we can use various embedding techniques, some
of which are explained briefly below.
of which are explained briefly below.


Basis Embedding
Expand All @@ -44,7 +44,7 @@ and :math:`x^{(2)}=11`. The corresponding basis encoding uses two qubits to repr

.. math:: | \mathcal{D} \rangle = \frac{1}{\sqrt{2}}|01 \rangle + \frac{1}{\sqrt{2}} |11 \rangle.

.. note:: For :math:`N` bits, there are :math:`2^N` possible basis states. Given :math:`M \ll 2^N`, the basis embedding of :math:`\mathcal{D}` will be sparse.
.. note:: For :math:`N` bits, there are :math:`2^N` possible basis states. Given :math:`M \ll 2^N`, the basis embedding of :math:`\mathcal{D}` will be sparse.


Amplitude Embedding
Expand All @@ -61,32 +61,32 @@ the :math:`i`-th computational basis state. In this case, however, :math:`x_i` c
data types, e.g., integer or floating point. For example, let's say we want to encode the four-dimensional
floating-point array :math:`x=(1.0, 0.0, -5.5, 0.0)` using amplitude embedding. The first step is to normalize it, i.e., :math:`x_{norm}=\frac{1}{\sqrt{31.25}}(1.0, 0.0, -5.5, 0.0)`. The corresponding amplitude encoding uses two qubits to represent :math:`x_{norm}` as

.. math:: | \psi_{x_{norm}} \rangle = \frac{1}{\sqrt{31.25}}\left[|00 \rangle - 5.5|10 \rangle\right].
.. math:: | \psi_{x_{norm}} \rangle = \frac{1}{\sqrt{31.25}}\left[|00 \rangle - 5.5|10 \rangle\right].

Let's consider the classical dataset :math:`\mathcal{D}` mentioned above. Its amplitude embedding
can be easily understood if we concatenate all the input examples :math:`x^{(m)}` together into one
vector, i.e.,
vector, i.e.,

.. math:: \alpha = C_{norm} \{ x^{(1)}_1, \ldots, x^{(1)}_N, x^{(2)}_1, \ldots, x^{(2)}_N, \ldots, x^{(M)}_1, \ldots, x^{(M)}_N \},

where :math:`C_{norm}` is the normalization constant; this vector must be normalized :math:`|\alpha|^2=1`. The input dataset can now be represented in the computational basis as

.. math:: | \mathcal{D} \rangle = \sum_{i=1}^{2^n} \alpha_i |i \rangle,

where :math:`\alpha_i` are the elements of the amplitude vector :math:`\alpha` and :math:`| i \rangle`
are the computational basis states. The number of amplitudes to be encoded is :math:`N \times M`.
are the computational basis states. The number of amplitudes to be encoded is :math:`N \times M`.
As a system of :math:`n` qubits provides :math:`2^n` amplitudes, **amplitude embedding requires** :math:`\mathbf{n \geq \log_2({NM})}` **qubits.**


.. note::
If the total number of amplitudes to embed, i.e., :math:`N \times M`, is less than
:math:`2^n`, *non-informative* constants can be *padded* to :math:`\alpha`
:cite:`schuld2018supervised`.

For example, if we have 3 examples with 2 features each, we have
:math:`3\times 2= 6` amplitudes to embed. However, we have to use at least
:math:`\lceil \log_2(6)\rceil = 3` qubits, with :math:`2^3=8` available states. We
therefore have to concatenate :math:`2^3-6=2` constants at the end of :math:`\alpha`.
therefore have to concatenate :math:`2^3-6=2` constants at the end of :math:`\alpha`.


.. important::
Expand All @@ -95,7 +95,7 @@ As a system of :math:`n` qubits provides :math:`2^n` amplitudes, **amplitude emb
with continuous-variable quantum computing models, where classical information
is encoded in the squeezing and displacement operator parameters.
*Hamiltonian embedding* uses an implicit technique by encoding information in the
evolution of a quantum system :cite:`schuld2018supervised`.
evolution of a quantum system :cite:`schuld2018supervised`.

.. seealso:: PennyLane provides built-in embedding templates; see :doc:`introduction/templates` for more details.

.. seealso:: PennyLane provides built-in embedding templates; see :mod:`pennylane.templates.embeddings` for more details.

2 changes: 1 addition & 1 deletion concepts/hybrid_computation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Hybrid computation
==================

In the introduction, we briefly introduced the notion of :mod:`quantum nodes <pennylane.qnode>`. This abstraction lets us combine quantum functions with classical functions as part of a larger hybrid quantum-classical computation.
In the introduction, we briefly introduced the notion of quantum nodes. This abstraction lets us combine quantum functions with classical functions as part of a larger hybrid quantum-classical computation.

Hybrid computations have been considered in many existing proposals. However, the division of labour between the quantum and classical components is often very rigid. Typically, quantum devices are used to evaluate some circuit(s), and the resulting expectation values are combined in a single classical cost function.

Expand Down
2 changes: 1 addition & 1 deletion concepts/quantum_nodes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ A quantum node is a computational encapsulation of a quantum function :math:`f(x

So long as we provide some mechanism for evaluating quantum nodes (i.e., a quantum computing device or simulator), a classical computing device can treat it as it would any other callable function which manipulates classical data. We can thus connect quantum nodes with classical transformations to build complex multistage :ref:`hybrid quantum-classical computations <hybrid_computation>`.

.. seealso:: PennyLane's implementation of quantum nodes: :mod:`pennylane.decorator`
.. seealso:: PennyLane's implementation of quantum nodes: :doc:`introduction/circuits`

.. rubric:: Footnotes

Expand Down

0 comments on commit 96778fb

Please sign in to comment.