Skip to content

Commit

Permalink
Redesign docs (#60)
Browse files Browse the repository at this point in the history
* add third device

* backup

* add link to docs

* add forum

* fix api

* polish

* Update README.rst

Co-Authored-By: Theodor <theodor@xanadu.ai>

* Update doc/devices/ibm.rst

Co-Authored-By: Theodor <theodor@xanadu.ai>

* Update pennylane_pq/ops.py

Co-Authored-By: Theodor <theodor@xanadu.ai>

Co-authored-by: Theodor <theodor@xanadu.ai>
  • Loading branch information
mariaschuld and thisac committed Apr 14, 2020
1 parent a4b2e13 commit 648f337
Show file tree
Hide file tree
Showing 125 changed files with 1,949 additions and 4,065 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ PennyLane_PQ.egg-info/
.pytest_cache/
coverage_html_report/
.coverage
doc/code/api/*
89 changes: 32 additions & 57 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,22 @@ PennyLane ProjectQ Plugin

.. header-start-inclusion-marker-do-not-remove
The PennyLane-ProjectQ plugin integrates the ProjectQ quantum computing library with PennyLane's
quantum machine learning capabilities.

`PennyLane <https://pennylane.readthedocs.io>`_ is a cross-platform Python library for quantum machine
learning, automatic differentiation, and optimization of hybrid quantum-classical computations.

`ProjectQ <https://projectq.readthedocs.io>`_ is an open-source compilation framework capable of targeting various types of hardware and a high-performance quantum computer simulator with emulation capabilities, and various compiler plug-ins.
`ProjectQ <https://projectq.readthedocs.io>`_ is an open-source compilation framework capable of
targeting various types of hardware and a high-performance quantum computer simulator with
emulation capabilities, and various compiler plug-ins.

This PennyLane plugin allows to use both the software and hardware backends of ProjectQ as devices for PennyLane.

.. header-end-inclusion-marker-do-not-remove
The documentation can be found at `https://pennylane-pq.readthedocs.io`_.


Features
========
Expand All @@ -44,7 +53,6 @@ Features

* Combine ProjectQ high performance simulator and hardware backend support with PennyLane's automatic differentiation and optimization.

.. header-end-inclusion-marker-do-not-remove
.. installation-start-inclusion-marker-do-not-remove
Installation
Expand All @@ -62,61 +70,23 @@ To test that the PennyLane ProjectQ plugin is working correctly you can run
$ make test
in the source folder. Tests restricted to a specific device can be run by executing :code:`make test-simulator`, :code:`make test-ibm`, or :code:`make test-classical`.

.. note:: Tests on the `ibm device <https://pennylane-pq.readthedocs.io/en/latest/devices.html#projectqibmbackend>`_ can only be run if a :code:`user` and :code:`password` for the `IBM Q experience <https://quantumexperience.ng.bluemix.net/qx/experience>`_ are configured in the `PennyLane configuration file <https://pennylane.readthedocs.io/en/latest/code/configuration.html>`_. If this is the case, running :code:`make test` also executes tests on the :code:`ibm` device. By default tests on the :code:`ibm` device run with :code:`hardware=False`. At the time of writing this means that the test are "free". Please verify that this is also the case for your account.

.. installation-end-inclusion-marker-do-not-remove
.. gettingstarted-start-inclusion-marker-do-not-remove
Getting started
===============

You can instantiate a :code:`'projectq.simulator'` device for PennyLane with:

.. code-block:: python
import pennylane as qml
dev = qml.device('projectq.simulator', wires=2)
in the source folder. Tests restricted to a specific device can be run by executing
:code:`make test-simulator`, :code:`make test-ibm`, or :code:`make test-classical`.

This device can then be used just like other devices for the definition and evaluation of QNodes within PennyLane. A simple quantum function that returns the expectation value of a measurement and depends on three classical input parameters would look like:
.. note::

.. code-block:: python
Tests on the `ibm device <https://pennylane-pq.readthedocs.io/en/latest/devices.html#projectqibmbackend>`_
can only be run if a :code:`user` and :code:`password` for the
`IBM Q experience <https://quantumexperience.ng.bluemix.net/qx/experience>`_ are configured
in the `PennyLane configuration file <https://pennylane.readthedocs.io/en/latest/code/api/pennylane.Configuration.html>`_.
If this is the case, running :code:`make test` also executes tests on the :code:`ibm` device.
By default tests on the :code:`ibm` device run with :code:`hardware=False`. At the time of writing this
means that the test are "free". Please verify that this is also the case for your account.

@qml.qnode(dev)
def circuit(x, y, z):
qml.RZ(z, wires=[0])
qml.RY(y, wires=[0])
qml.RX(x, wires=[0])
qml.CNOT(wires=[0, 1])
return qml.expval(qml.PauliZ(wires=1))
You can then execute the circuit like any other function to get the quantum mechanical expectation value.

.. code-block:: python
circuit(0.2, 0.1, 0.3)
Running your code on an IBM Quantum Experience simulator or even a real hardware chip is just as easy. Instead of the device above, you would instantiate a :code:`'projectq.ibm'` device by giving your IBM Quantum Experience username and password:

.. code-block:: python
import pennylane as qml
dev = qml.device('projectq.ibm', wires=2, user="XXX", password="XXX")
In order to avoid accidentally publishing your credential, you should better specify them via the `PennyLane configuration file <https://pennylane.readthedocs.io/en/latest/code/configuration.html>`_ by adding a section such as

.. code::
[projectq.global]
[projectq.ibm]
user = "XXX"
password = "XXX"
.. gettingstarted-end-inclusion-marker-do-not-remove
.. installation-end-inclusion-marker-do-not-remove
Please refer to the `documentation of the PennyLane ProjectQ Plugin <https://pennylane-pq.readthedocs.io/>`_ as well as well as to the `documentation of PennyLane <https://pennylane.readthedocs.io/>`_ for further reference.
Please refer to the `documentation of the PennyLane ProjectQ Plugin <https://pennylane-pq.readthedocs.io/>`_
as well as well as to the `documentation of PennyLane <https://pennylane.readthedocs.io/>`_ for further reference.

.. howtocite-start-inclusion-marker-do-not-remove
Expand All @@ -133,9 +103,11 @@ Contributing
============

We welcome contributions - simply fork the repository of this plugin, and then make a
`pull request <https://help.github.com/articles/about-pull-requests/>`_ containing your contribution. All contributers to this plugin will be listed as authors on the releases.
`pull request <https://help.github.com/articles/about-pull-requests/>`_ containing your contribution.
All contributers to this plugin will be listed as authors on the releases.

We also encourage bug reports, suggestions for new features and enhancements, and even links to cool projects or applications built on PennyLane.
We also encourage bug reports, suggestions for new features and enhancements, and even
links to cool projects or applications built on PennyLane.


Authors
Expand All @@ -150,15 +122,18 @@ Support

- **Source Code:** https://github.com/XanaduAI/pennylane-pq
- **Issue Tracker:** https://github.com/XanaduAI/pennylane-pq/issues
- **PennyLane Forum:** https://discuss.pennylane.ai

If you are having issues, please let us know by posting the issue on our Github issue tracker.
If you are having issues, please let us know by posting the issue on our Github issue tracker, or
by asking a question in the forum.

.. support-end-inclusion-marker-do-not-remove
.. license-start-inclusion-marker-do-not-remove
License
=======

The PennyLane ProjectQ plugin is **free** and **open source**, released under the `Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>`_.
The PennyLane ProjectQ plugin is **free** and **open source**, released under
the `Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>`_.

.. license-end-inclusion-marker-do-not-remove
Binary file added doc/_static/puzzle_pq.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
240 changes: 240 additions & 0 deletions doc/_static/xanadu_gallery.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@

/*
Sphinx-Gallery has compatible CSS to fix default sphinx themes
Tested for Sphinx 1.3.1 for all themes: default, alabaster, sphinxdoc,
scrolls, agogo, traditional, nature, haiku, pyramid
Tested for Read the Docs theme 0.1.7 */
.sphx-glr-thumbcontainer {
background: #fff;
border: solid #dedede 0px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
box-shadow: 0 2px 5px 0 rgba(0,0,0,.04),0 2px 25px 2px rgba(0,0,0,.04);
float: left;
margin: 5px;
min-width: 200px;
min-height: 200px;
padding-top: 5px;
position: relative;
text-align: center;
border-radius: 10px;
transition: 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.sphx-glr-thumbcontainer:hover {
border: solid #b4ddfc 0px;
box-shadow: 0 2px 5px 0 rgba(0,0,0,.09),0 2px 40px 2px rgba(0,0,0,.09);
transition: 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}
/*.sphx-glr-thumbcontainer:hover > .figure > img {*/
/*transform: scale(1.08);*/
/*transition: 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);*/
/*}*/


.sphx-glr-thumbcontainer a.internal {
bottom: 0;
display: block;
left: 0;
padding: 150px 10px 0;
position: absolute;
right: 0;
top: 0;
color: #575757;
}

/* Next one is to avoid Sphinx traditional theme to cover all the
thumbnail with its default link Background color */
.sphx-glr-thumbcontainer a.internal:hover {
background-color: transparent;
color: #575757;
text-decoration: none;
}

.sphx-glr-thumbcontainer p {
margin: 0 0 .1em 0;
}
.sphx-glr-thumbcontainer .figure {
margin: 10px;
width: 160px;
}
.sphx-glr-thumbcontainer img {
display: inline;
max-height: 160px;
width: 160px;
}
.sphx-glr-thumbcontainer[tooltip]:hover:after {
background: rgba(0, 0, 0, 0.8);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
color: #fff;
content: attr(tooltip);
left: 95%;
padding: 5px 15px;
position: absolute;
z-index: 98;
width: 220px;
bottom: 52%;
display: none;
}
.sphx-glr-thumbcontainer[tooltip]:hover:before {
border: solid;
border-color: #333 transparent;
border-width: 18px 0 0 20px;
bottom: 58%;
content: '';
left: 85%;
position: absolute;
z-index: 99;
display: none;
}

.highlight-pytb pre {
background-color: #ffe4e4;
border: 1px solid #f66;
margin-top: 10px;
padding: 7px;
}

.sphx-glr-script-out {
color: #888;
margin: 0;
}
.sphx-glr-script-out .highlight {
background-color: transparent;
margin-left: 2.5em;
margin-top: -1.4em;
}
.sphx-glr-script-out .highlight pre {
background-color: #fafae2;
border: 0;
max-height: 30em;
overflow: auto;
padding-left: 1ex;
margin: 0px;
word-break: break-word;
}
.sphx-glr-script-out + p {
margin-top: 1.8em;
}
blockquote.sphx-glr-script-out {
margin-left: 0pt;
}

div.sphx-glr-footer {
text-align: center;
margin-bottom: -40px;
}

div.binder-badge {
margin: 1em auto;
vertical-align: middle;
}

div.sphx-glr-download {
margin: 1em auto;
vertical-align: middle;
}

div.sphx-glr-download a {
background-color: #fff;
background-image: none;
border-radius: 0px;
border-bottom: 1px solid #c2c22d;
color: #000;
display: inline-block;
font-weight: bold;
padding: 0ex;
text-align: center;
border: none;
}

div.sphx-glr-download code.download {
display: inline;
white-space: normal;
word-break: normal;
overflow-wrap: break-word;
border: none;
background: none;
font-family: "Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;

}

div.sphx-glr-download a:hover {
box-shadow: none;
text-decoration: none;
background-image: none;
background-color: #fff;
border-bottom: 1px solid #405c4d;
}

.sphx-glr-example-title > :target::before {
display: block;
content: "";
margin-top: -50px;
height: 50px;
visibility: hidden;
}

ul.sphx-glr-horizontal {
list-style: none;
padding: 0;
}
ul.sphx-glr-horizontal li {
display: inline;
}
ul.sphx-glr-horizontal img {
height: auto !important;
}

.sphx-glr-single-img {
margin: auto;
display: block;
max-width: 100%;
}

.sphx-glr-multi-img {
max-width: 42%;
height: auto;
}

p.sphx-glr-signature a.reference.external {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
padding: 3px;
font-size: 75%;
text-align: right;
margin-left: auto;
display: table;
}
.sphx-glr-download-link-note {
display: none;
}

.container {
width: unset;
}

.sphx-glr-script-out .highlight pre {
background-color: #f7f7f7;
}


#tutorial-type {
display: none;
}


.sphx-glr-download-link-note.admonition.note,
.sphx-glr-signature {
display: none;
}

.sphx-glr-timing {
margin-bottom: 40px;
margin-top: 20px;
text-align: center;
font-size: small;
}
Binary file added doc/_static/xanadu_x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions doc/_templates/autosummary/base.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{ fullname | replace("pennylane", "qml") | escape | underline}}

.. currentmodule:: {{ module }}

.. auto{{ objtype }}:: {{ objname }}

0 comments on commit 648f337

Please sign in to comment.