Skip to content

Commit

Permalink
Merge the master branch into dev (#283)
Browse files Browse the repository at this point in the history
* Update repo to use the PennyLane and QChem v0.15.1  (#262)

* Update repo to use the PennyLane and QChem v0.15.1

* more

* Fixed typos in qubit rotation tutorial (#264)

1. 'a measurement' instead of 'an measurement'
2. a compound predicate should not have a separating comma

* Upgrade sphinx-gallery to v0.9 (#268)

* Update requirements.txt

* Update conf.py

* Update requirements.txt

* Update config.yml

* Adds Feedback-Based Quantum Optimization (FALQON) Tutorial (#265)

* initial commit

* notebooks

* Add basic theory

* Update falqon_david.ipynb

* Update falqon_david.ipynb

* Update falqon_david.ipynb

* Update falqon_david.ipynb

* change

* change

* changes

* Update falqon_david.ipynb

* Update falqon_david.ipynb

* bird seed

* change

* Update falqon_david-checkpoint.ipynb

* Add real data set

* Update falqon_david.ipynb

* Update falqon_david.ipynb

* Update falqon_david.ipynb

* Update falqon_david.ipynb

* python file

* adds maxclique image

* bird seed

* edits to tutorial

* tiny change

* Update falqon_david.ipynb

* Update falqon_david.ipynb

* Add short benchmark summary

* change

* change

* change

* tutorial changes

* final changes

* change

* Delete falqon_david-checkpoint.ipynb

* cite

* link

* changes

* Apply suggestions from code review

Co-authored-by: ixfoduap <40441298+ixfoduap@users.noreply.github.com>

* change

* JM review

* Various minor changes, update benchmark data

* Implement Olivia's suggestions except phi normalization and math at start

* Change phi normalization

* Simplify introductory math

* Fix math error

* Fix math error

* Update tutorial_falqon.py

* Update tutorial_falqon.py

* Update tutorial_falqon.py

* change

* change

* Apply suggestions from code review

Co-authored-by: ixfoduap <40441298+ixfoduap@users.noreply.github.com>

* change

* change

* Update demonstrations/tutorial_falqon.py

Co-authored-by: ixfoduap <40441298+ixfoduap@users.noreply.github.com>

* Update falqon.py

* Apply suggestions from code review

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* small change

Co-authored-by: David Wakeham <david.a.wakeham@gmail.com>
Co-authored-by: ixfoduap <40441298+ixfoduap@users.noreply.github.com>
Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* use adjoint (#272)

* CH1132 | Fix TOC Bug In Xanadu Themes (#274)

* Table of contents no longer disapears at the bottom of page

* Adds missing semi-colon

* Revert psycf version

* Updates comments

* TOC top matches docs page

* Reverts _static/thumbs/

* Update tutorial_falqon.py

* CH4398 | Fix Community Card Anchors (#275)

* Page scrolls to card if hash is present in URL

* Adds id to card that consists of first letters of title of card and author last name

* IDs are more readable

* Hovering over active card does not remove active class

* IDs no longer have accents

* Active class remains on cards

* CH4568 | Fix Size Of Community Demo Cards (#277)

* Card header uses flexbox

* Cards are same height, text is scrollable

* Descriptions are the same height and overflow is hidden

* Updates read more button

* Overflowing text shows read more link

* Adds modals to read descriptions

* Removes default button styling

* Fixes button alignment

* Community cards are responsive

* JS handles text overflow on page resizing

* Removes unnecessary p tags

* Update videos.rst (#278)

* Update demos_research.rst

* Fix FALQON Tutorial (#280)

* change

* fix

* Made sure to keep track of running best_cost (#281)

This ensures that our computed output_bloch_v is truly the best one encountered in gradient descent, instead of one computed by just any parameters that result in a cost less than our very first initial cost.

* increment cache number

* Tutorial Classical Shadows  (#263)

* Create tutorial_classical_shadows.py

* first working version for single qubit

* added comments, multiqubit is working

* adding rough intro to tutorial, metadata, and integrating with qml docs

* Formatting the comments

* adding shadow_state() and snapshot_state()

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: bdoolittle <brian.d.doolittle@gmail.com>

* adding image and updating introduction

* integrating test code into demo

* adding section headings

* 90 character limit to ensure page is rendered correctly

* Added background to classical shadows

* adding theory portion to state reconstruction section

* small fix on heading

* minor updates to the state reconstruction section

* updating state reconstruction tests

* state reconstruction example

* Wrapped up background

* Restructuring, introducing testing

* Got rid of duplicate information

* quick fixes/rearrangement

* median of means, formatting

* minor fixes

* edits/flow

* Estimating Pauli observables introduction

* adding expected test code-blocks

* fixed math

* Adding final example and shadow bound test

* fix typos

* ran black, added part about pytest, added test output, added random seed

* dots

* adding card image

* fix to meta data

* small typo's

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>

* moving demo to research category

* fixing citations

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>

* fixing broken equation

* removing tests

* changing plot

* Addressing comments pt 1

* Remove type suggestions.

* black

* small fixes, added conclusion

* Changed shadow to two seperate arrays, simplified observable estimator.

* added comments

* small typos

* Make docstrings consistent.

* Fix citations

* Small improvements to text flow

* ran through spellcheck

* Changed final figure, addressed most comments.

* A single dot.

* Update demos_research.rst

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Changed

* Bullet rendering issue

* print formatting fix

* unblack

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>

* Explain single clifford ensemble

* Apply suggestions from code review

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: rooler <roel.wier@gmail.com>
Co-authored-by: Roeland Wiersema <32705838+therooler@users.noreply.github.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>
Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Adding Header Image to Classical Shadows Demo (#284)

* Create tutorial_classical_shadows.py

* first working version for single qubit

* added comments, multiqubit is working

* adding rough intro to tutorial, metadata, and integrating with qml docs

* Formatting the comments

* adding shadow_state() and snapshot_state()

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: bdoolittle <brian.d.doolittle@gmail.com>

* adding image and updating introduction

* integrating test code into demo

* adding section headings

* 90 character limit to ensure page is rendered correctly

* Added background to classical shadows

* adding theory portion to state reconstruction section

* small fix on heading

* minor updates to the state reconstruction section

* updating state reconstruction tests

* state reconstruction example

* Wrapped up background

* Restructuring, introducing testing

* Got rid of duplicate information

* quick fixes/rearrangement

* median of means, formatting

* minor fixes

* edits/flow

* Estimating Pauli observables introduction

* adding expected test code-blocks

* fixed math

* Adding final example and shadow bound test

* fix typos

* ran black, added part about pytest, added test output, added random seed

* dots

* adding card image

* fix to meta data

* small typo's

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>

* moving demo to research category

* fixing citations

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>

* fixing broken equation

* removing tests

* changing plot

* Addressing comments pt 1

* Remove type suggestions.

* black

* small fixes, added conclusion

* Changed shadow to two seperate arrays, simplified observable estimator.

* added comments

* small typos

* Make docstrings consistent.

* Fix citations

* Small improvements to text flow

* ran through spellcheck

* Changed final figure, addressed most comments.

* A single dot.

* Update demos_research.rst

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>

* Changed

* Bullet rendering issue

* print formatting fix

* unblack

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>

* Explain single clifford ensemble

* Apply suggestions from code review

* Update demonstrations/tutorial_classical_shadows.py

* adding header image

* Update demonstrations/tutorial_classical_shadows.py

* Update demonstrations/tutorial_classical_shadows.py

Co-authored-by: rooler <roel.wier@gmail.com>
Co-authored-by: Roeland Wiersema <32705838+therooler@users.noreply.github.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>
Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>
Co-authored-by: Nathan Killoran <co9olguy@users.noreply.github.com>

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Tommy Vo Tran <tomvotran@ucla.edu>
Co-authored-by: Jack Ceroni <jackceroni@gmail.com>
Co-authored-by: David Wakeham <david.a.wakeham@gmail.com>
Co-authored-by: ixfoduap <40441298+ixfoduap@users.noreply.github.com>
Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>
Co-authored-by: Maria Schuld <mariaschuld@gmail.com>
Co-authored-by: Andrew Gardhouse <AndrewGardhouse@gmail.com>
Co-authored-by: Nathan Killoran <co9olguy@users.noreply.github.com>
Co-authored-by: bdoolittle <brian.d.doolittle@gmail.com>
Co-authored-by: rooler <roel.wier@gmail.com>
Co-authored-by: Roeland Wiersema <32705838+therooler@users.noreply.github.com>
Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>
  • Loading branch information
14 people committed Jun 15, 2021
1 parent 127b588 commit d0c40ff
Show file tree
Hide file tree
Showing 23 changed files with 1,576 additions and 175 deletions.
17 changes: 9 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ jobs:
- restore_cache:
keys:
# when lock file changes, use increasingly general patterns to restore cache
- pip-v24c-{{ .Branch }}-{{ checksum "requirements.txt" }}
- pip-v24c-{{ .Branch }}-
- pip-v24c-
- pip-v25c-{{ .Branch }}-{{ checksum "requirements.txt" }}
- pip-v25c-{{ .Branch }}-
- pip-v25c-

- run:
name: Install dependencies
command: |
sudo apt install pandoc -qq
python3 -m venv venv
. venv/bin/activate
pip install pip setuptools --upgrade
Expand All @@ -35,13 +36,13 @@ jobs:
- save_cache:
paths:
- venv
key: pip-v24c-{{ .Branch }}-{{ checksum "requirements.txt" }}
key: pip-v25c-{{ .Branch }}-{{ checksum "requirements.txt" }}

- restore_cache:
keys:
- gallery-v24a-{{ .Branch }}-{{ .Revision }}
- gallery-v24a-{{ .Branch }}-
- gallery-v24a-
- gallery-v25a-{{ .Branch }}-{{ .Revision }}
- gallery-v25a-{{ .Branch }}-
- gallery-v25a-

- run:
name: Build tutorials
Expand All @@ -57,7 +58,7 @@ jobs:
- save_cache:
paths:
- ./demos
key: gallery-v24a-{{ .Branch }}-{{ .Revision }}
key: gallery-v25a-{{ .Branch }}-{{ .Revision }}

- save_cache:
paths:
Expand Down
1 change: 1 addition & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
# and skip those that don't. If the following option is not provided,
# all example scripts in the 'examples_dirs' folder will be skiped.
"filename_pattern": r"tutorial",
"pypandoc": True,
# first notebook cell in generated Jupyter notebooks
"first_notebook_cell": (
"# This cell is added by sphinx-gallery\n"
Expand Down
78 changes: 62 additions & 16 deletions custom_directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,50 @@ def run(self):
COMMUNITY_CARD_TEMPLATE = """
.. raw:: html
<div class="card plugin-card">
<h4 class="card-header {color} lighten-4">{title}</h4>
<div class="card-body">
<h6>{author}</h6>
<p class="font-small"><i class="far fa-clock pr-1"></i>{date}</p>
<div class="row d-flex align-items-center">
<div class="col-lg-8">
<p class="card-text">
{description}
</p>
<div class="col-lg-6 mb-4">
<div class="card plugin-card" id={id}>
<div class="card-header {color} lighten-4">
<h4 class="card-header__text">{title}</h4>
</div>
<div class="card-body">
<div class="row">
<div class="col-lg-8 d-flex flex-column">
<div>
<h6>{author}</h6>
<p class="font-small"><i class="far fa-clock pr-1"></i>{date}</p>
</div>
<p class="plugin-card__description">
{description}
</p>
<div class="mt-auto plugin-card__read-more-wrapper">
<a class="plugin-card__read-more text-primary d-none" data-toggle="modal" data-target="#{id}-modal">Read More</a>
</div>
</div>
<div class="col-lg-4 d-flex">
<div class="plugin-card__buttons">
{paper_footer}
{blog_footer}
{code_footer}
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="{id}-modal" tabindex="-1" role="dialog" aria-labelledby="{id}-modal" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title mt-0">{title}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{description}
</div>
<div class="col-lg-4">
<div class="modal-footer">
{paper_footer}
{blog_footer}
{code_footer}
Expand All @@ -207,17 +239,17 @@ def run(self):
</div>
"""

PAPER_FOOTER = """<a href="{paper}" class="btn btn-info" style="box-shadow: unset; border-radius:5px; width:90%;">
PAPER_FOOTER = """<a href="{paper}" class="btn btn-info plugin-card__paper-btn">
<i class="fas fa-book"></i> Paper
</a>
"""

BLOG_FOOTER = """<a href="{blog}" class="btn btn-info" style="box-shadow: unset; border-radius:5px; width:90%;">
BLOG_FOOTER = """<a href="{blog}" class="btn btn-info plugin-card__blog-btn">
<i class="fas fa-newspaper"></i> Blog
</a>
"""

CODE_FOOTER = """<a href="{code}" class="btn btn-default" style="box-shadow: unset; border-radius:5px; width:90%;">
CODE_FOOTER = """<a href="{code}" class="btn btn-default plugin-card__code-btn">
<i class="fas fa-code-branch"></i></i> Code
</a>
"""
Expand Down Expand Up @@ -258,12 +290,25 @@ def run(self):

if code_url is not None:
code_footer = CODE_FOOTER.format(code=code_url)

blog_url = self.options.get("blog", None)

if blog_url is not None:
blog_footer = BLOG_FOOTER.format(blog=blog_url)

def remove_accents(raw_text):
"""Removes common accent characters."""

raw_text = re.sub(u"[àáâãäå]", 'a', raw_text)
raw_text = re.sub(u"[èéêë]", 'e', raw_text)
raw_text = re.sub(u"[ìíîï]", 'i', raw_text)
raw_text = re.sub(u"[òóôõö]", 'o', raw_text)
raw_text = re.sub(u"[ùúûü]", 'u', raw_text)
raw_text = re.sub(u"[ýÿ]", 'y', raw_text)
raw_text = re.sub(u"[ß]", 'ss', raw_text)
raw_text = re.sub(u"[ñ]", 'n', raw_text)
return raw_text

card_rst = COMMUNITY_CARD_TEMPLATE.format(
title=self.options["title"],
author=self.options["author"],
Expand All @@ -272,7 +317,8 @@ def run(self):
paper_footer=paper_footer,
code_footer=code_footer,
blog_footer=blog_footer,
color=color
color=color,
id=remove_accents(self.options["author"].split(" ")[-1].lower()) + self.options["date"].split("/")[-1] + self.options["title"].split(" ")[0].lower(),
)

thumbnail = StringList(card_rst.split('\n'))
Expand Down
Binary file added demonstrations/classical_shadows/atom_shadow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demonstrations/falqon/bench.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demonstrations/falqon/bird_seed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demonstrations/falqon/falqon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demonstrations/falqon/falqon_thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demonstrations/falqon/global_min_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demonstrations/falqon/max_clique.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d0c40ff

Please sign in to comment.