Skip to content

Commit

Permalink
Replace macros in demo "Here comes the SU(N)" (#745)
Browse files Browse the repository at this point in the history
* Development branch

* Bumped requirement package versions (#667)

* Bumped jax versions

* Updated neural-tangents

* Merge dev in master following v0.28.0 release of PennyLane (#671) (#672)

* Development branch

* Bumped requirement package versions (#667)

* Bumped jax versions

* Updated neural-tangents

* Apply suggestions from code review

Co-authored-by: Josh Izaac <[email protected]>
Co-authored-by: GitHub Nightly Merge Action <[email protected]>
Co-authored-by: Rashid N H M <[email protected]>

Co-authored-by: Jay Soni <[email protected]>
Co-authored-by: Josh Izaac <[email protected]>
Co-authored-by: GitHub Nightly Merge Action <[email protected]>

* add demo, v0.1

* update demo with shots optimization

* improvements to text, remove notes, draw circuit.

* black

* remove qml.optimize dependency

* update, improve code

* Update chemical reactions demo to use pyscf for openshell H3 (#704)

* use pyscf for openshell H3

* change date and fix interface warning

* Change ibm device in Quantum volume (#703)

* Ibm oslo

* Update to new hardware

* Change to Lima

* Typo

* Replace

* One below

* Update demos to remove warnings (#705)

* Added interface, removed deprecated functionality

* Addressing PR comments

---------

Co-authored-by: Romain Moyard <[email protected]>

* tmp

* Update classical shadows (#708)

* More

* typo

* Trigger CI

* lightning req no depth

* Trigger CI

* Update SPSA demo to count circuit executions manually. (#706)

* new version of SPSA demo

* Update demonstrations/spsa.py

Co-authored-by: Josh Izaac <[email protected]>

* simplify code, update outputs and figures

* Apply suggestions from code review

Co-authored-by: Romain Moyard <[email protected]>

* review and tweaking

* make spsa an executing tutorial

* move file

* fix links

* fix some more links

* author bio

* line breaks, undo link change, fixing them actually

* links...

* links again... bio

* update to count executions manually

* reword device executions -> circuit executions. avoid recreating device and qnode

* print executions

---------

Co-authored-by: Josh Izaac <[email protected]>
Co-authored-by: Romain Moyard <[email protected]>

* large update, include gradient evaluation discussion

* some jax

* add paper plot

* images

* black

* tmp

* add thumbnail

* change to png

* black

* uncomment. improve line breaks/naming

* hist colors

* update figure and size

* colors, text

* formulation around sampled_grad plot

* new image

* png

* links

* cosmetics

* cosmetics

* new figures

* increase embedded image sizes

* update intro

* optimization curve image

* review

* Apply suggestions from code review

Co-authored-by: Guillermo Alonso-Linaje <[email protected]>

* debugging, intro teaser

* Apply suggestions from code review

Co-authored-by: Guillermo Alonso-Linaje <[email protected]>

* review

* new thumbnail

* Apply suggestions from code review

Co-authored-by: Isaac De Vlugt <[email protected]>

* finalizing review

* whitespace

* update date to 30th, incl preprint number, add reference in intro

* change date to 3rd of April

* fix links

* bm macro

* remove duplicate gallery entry

---------

Co-authored-by: Josh Izaac <[email protected]>
Co-authored-by: GitHub Nightly Merge Action <[email protected]>
Co-authored-by: Rashid N H M <[email protected]>
Co-authored-by: Jay Soni <[email protected]>
Co-authored-by: soranjh <[email protected]>
Co-authored-by: Romain Moyard <[email protected]>
Co-authored-by: Mudit Pandey <[email protected]>
Co-authored-by: Guillermo Alonso-Linaje <[email protected]>
Co-authored-by: Isaac De Vlugt <[email protected]>
Co-authored-by: Nathan Killoran <[email protected]>
  • Loading branch information
11 people authored and lillian542 committed Apr 21, 2023
1 parent ba9d229 commit b1c5267
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions demonstrations/tutorial_here_comes_the_sun.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
.. math::
U(\bm{\theta}) = \exp\left\{\sum_{m=1}^d \theta_m G_m \right\}.
U(\boldsymbol{\theta}) = \exp\left\{\sum_{m=1}^d \theta_m G_m \right\}.
The number of coordinates and Pauli words in :math:`\mathcal{P}^{(n)}` is :math:`d=4^n-1`.
Therefore, this will be the number of parameters that a single ``qml.SpecialUnitary`` gate acting on
Expand All @@ -146,7 +146,7 @@
For unitaries generated by a single operator, i.e. of the form :math:`\exp(i\theta G)`,
there is a plethora of differentiation techniques that allow us to compute its derivative.
However, a standard parameter-shift rule, for example, will not do the job if there are
non-commuting terms :math:`G_m` in the multi-parameter gate :math:`U(\bm{\theta})` above.
non-commuting terms :math:`G_m` in the multi-parameter gate :math:`U(\boldsymbol{\theta})` above.
So how *do* we compute the derivative?
Obtaining the gradient
Expand Down Expand Up @@ -191,11 +191,11 @@
.. math::
\partial_{\text{FD},\theta_j}C(\bm{\theta})
=\left[C\left(\bm{\theta}+\frac{\delta}{2}\bm{e}_j\right)
-C\left(\bm{\theta}-\frac{\delta}{2}\bm{e}_j\right)\right] / \delta.
\partial_{\text{FD},\theta_j}C(\boldsymbol{\theta})
=\left[C\left(\boldsymbol{\theta}+\frac{\delta}{2}\boldsymbol{e}_j\right)
-C\left(\boldsymbol{\theta}-\frac{\delta}{2}\boldsymbol{e}_j\right)\right] / \delta.
Here, :math:`\delta` is a shift parameter that we need to choose and :math:`\bm{e}_j` is the
Here, :math:`\delta` is a shift parameter that we need to choose and :math:`\boldsymbol{e}_j` is the
:math:`j`-th canonical basis vector, i.e. the all-zeros vector with a one in the
:math:`j`-th entry. This approach is agnostic to the differentiated function and does
not exploit its structure.
Expand Down Expand Up @@ -265,7 +265,7 @@ def central_diff_grad(theta, delta):
# so in full generality, but for the particular circuit in this example. We will
# sample ten splitting times to obtain the gradient entry. For each splitting time,
# we need to insert a Pauli-:math:`Y` rotation because :math:`\theta_2` belongs to
# the Pauli-:math:`Y` component of :math:`A(\bm{\theta})`. For this, we define
# the Pauli-:math:`Y` component of :math:`A(\boldsymbol{\theta})`. For this, we define
# an auxiliary circuit.


Expand Down Expand Up @@ -350,7 +350,7 @@ def stochastic_parshift_grad(theta, num_samples):
# three differentiation methods? We will not go into detail here, but refer
# to [#wiersema]_ to see how the custom differentiation rule proposed in the
# main text leads to the lowest mean squared error. For a single-qubit circuit
# similar to the one above, but with the single gate :math:`U(\bm{\theta})=\exp(iaX+ibY)`,
# similar to the one above, but with the single gate :math:`U(\boldsymbol{\theta})=\exp(iaX+ibY)`,
# the derivative and its expected variance are shown in the following
# (recoloured) plot from the manuscript:
#
Expand Down

0 comments on commit b1c5267

Please sign in to comment.