Skip to content

Commit

Permalink
Development branch (#374)
Browse files Browse the repository at this point in the history
* fix

* Adds demo on unitary designs (#252)

* Initial commit; introductory details plus skeleton of remainder.

* Add details on complex projective and unitary designs.

* Add related demo.

* Update repo to use the PennyLane and QChem v0.15.1  (#262)

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

* more

* Major updates to section on twirling and fidelity.

* Major updates; finish code example.

* Change PL branch; update entry in TOC.

* Upload thumbnail.

* Apply suggestions from code review

* Rewrite example to use qfunc transforms.

* Add lots of references. Start conclusion.

* First full draft of demo.

* Apply suggestions from code review

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

* Fix dashes. Move multi-qubit Clifford discussion into main text.

* Add spherical design example. Cut complex projective design content.

* Elaborate on Clifford group and spherical designs.

* Rearrange some text.

* Apply suggestions from code review

* Streamline apply Clifford function.

* Apply suggestions from code review

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

* Remove histogram.

* Update text and add new graphics.

* Tweak text.

* Remove explicit deviation amount.

* Update requirements.txt

* Revert spurious changes to kernel tutorial.

* Apply suggestions from code review

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

* Update date.

* Remove extra line from merge.

* Fix link to Haar demo.

* Actually fix the link.

Co-authored-by: Olivia Di Matteo <dimatteo.olivia@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: ixfoduap <40441298+ixfoduap@users.noreply.github.com>

* Merge the `master` branch into `dev` (#283)

* 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>

* Set `shots=1000` in device (#286)

* 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.

* 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>

* Incorrect energy landscape in QNG demo (#285)

* Add files via upload

Correct energy landscape

* Update tutorial_vqe_qng.py

Switched blue and red.

Co-authored-by: antalszava <antalszava@gmail.com>

* update shots (and trim whitespace)

* setting things right

* fix back unrelated file

* fix

* Add shots=1000 to metrology demo.

* tweak init value

* Last updated

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>
Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: Olivia Di Matteo <dimatteo.olivia@gmail.com>

* Minor learning2learn fixes (#289)

* update minor things

* more minor fixes

* last updated date

Co-authored-by: Antal Szava <antalszava@gmail.com>

* Change PyTorch noisy demo to use Amazon Braket (#288)

* remove qpu line (errors with latest Forest)

* Update demonstrations/pytorch_noise.py

Co-authored-by: Nathan Killoran <co9olguy@users.noreply.github.com>

* QPU through Braket

* wording

* wording

* mention Amazon Braket

* Update demonstrations/pytorch_noise.py

Co-authored-by: Christina Lee <christina@xanadu.ai>

* Add Braket at the beginning as dep, further details on QPU

* mentioned QPU at the beginning

* Update demonstrations/pytorch_noise.py

Co-authored-by: Christina Lee <christina@xanadu.ai>

* minor

* pull in release candidate of PennyLane

Co-authored-by: Nathan Killoran <co9olguy@users.noreply.github.com>
Co-authored-by: Christina Lee <christina@xanadu.ai>

* Hide designs demo. (#295)

* Update `dev` before merging into `master` (#294)

* 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.

* 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>

* Incorrect energy landscape in QNG demo (#285)

* Add files via upload

Correct energy landscape

* Update tutorial_vqe_qng.py

Switched blue and red.

Co-authored-by: antalszava <antalszava@gmail.com>

* Add note about `qsimcirq` warning (#290)

* add note about qsimcirq warning

* Update demonstrations/qsim_beyond_classical.py

Co-authored-by: antalszava <antalszava@gmail.com>

Co-authored-by: antalszava <antalszava@gmail.com>

* cache inc

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>
Co-authored-by: Theodor <theodor@xanadu.ai>

* Requirements

* Update designs demo to use qml.apply and fix issues in dev (#306)

* Re-add demo. Fix issues and update use qml.apply.

* Apply suggestions from code review

* Change op to m for measurements.

* Update `tutorial_noisy_circuits.py` (#312)

* Update tutorial_noisy_circuits.py

* remove dimensionality of ev

* increment cache number

* @master for pl (#319)

* Update requirements.txt

Co-authored-by: antalszava <antalszava@gmail.com>

* Update requirements.txt

Co-authored-by: antalszava <antalszava@gmail.com>

* update requirements

* Update requirements.txt (#329)

* Add more `plt.show` calls in the l2l demo (#331)

* plt.show; last updated

* Model name

* diff_method=None (#332)

* Added a note to Quantum Volume Demo (#335)

* Added a note to teach users how to access a list of
available IBM Q backends

* Having two notes next to eachother looks visually bad so
I just merged it with the previous note

* Update requirements.txt

Co-authored-by: antalszava <antalszava@gmail.com>

* Update requirements.txt

Co-authored-by: antalszava <antalszava@gmail.com>

* Add dev branch

* Update demos to make use of the new qml.sample and qml.expval(H) functionality (story #: 8118)  (#330)

* Updated qsim to use the new qml.sample functionality
**needs to be tested ! **

* just removed one commented line

* Updated one of the paragraphs to be consistent with
the changes

* Updated coherent vqls to use the builtin functionality of
qml.sample, also tested it locally and it seems to run without
errors!

* updated qaoa_maxcut to use new qml.sample functionality

* updated vqls tutorial to make  use of the new functionality
of qml.sample

* Made some changes to chem reaction tutorial, want to confirm with
CI to see if it works properly because I can't run it locally

* fixed quick little bug with wires in circuit def

* quick change to help debug error in CI

* Found the bug with chem_reactions tutorial, hopefully
this fixes it

* updated falqon tutorial and removed dependance on qml.ExpvalCost,
still need to confirm it works with CI

* fixed a small bug, wrote Qnode isntead of QNode

* Updated falqon to use qml.expval instead of qml.ExpvalCost

* updated optimized measurement tutorial to make use of qml.expval,
still need to test with CI

* debugging measurement optimize tutorial

* The bug regarding Qnodes is well known, just made a change
the Christina suggested as a temporary fix

* Updated molecular geometry optimization tutorial to make
use of qml.expval

* Updated qaoa tutorial to make use of qml.expval, updated docs
in both examples to remove qml.ExpValCost

* Updated vqe and vqe qng tutorials to use qml.expval(H)

* Updated the vqe soin sectors demo with qml.expval, fixed a typo in
overview of vqe tutorial

* Updated parallel vqe tutorial to remove dependance on qml.ExpvalCost,
was not able to fully test this because I don't have rigitti setup

* Updated these tutorials to remove qml.ExpvalCost dependance

* Cleaning up some typos and comments

* Updated measurement optimization tutorial to make use of qml.Tracker

* Update demonstrations/tutorial_qaoa_maxcut.py

Co-authored-by: antalszava <antalszava@gmail.com>

* Update demonstrations/qsim_beyond_classical.py

Co-authored-by: antalszava <antalszava@gmail.com>

* Update demonstrations/tutorial_coherent_vqls.py

Co-authored-by: antalszava <antalszava@gmail.com>

* Updated tutorials based on pr comments

* Fixed bug in the spsa demo

* clean up

* Update demonstrations/tutorial_qaoa_maxcut.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* cleaned up docs

* Cleaning up documentation

* added comment

* Update demonstrations/braket-parallel-gradients.py

Co-authored-by: antalszava <antalszava@gmail.com>

* Clean up

- added variable num_wires to mol_geo_opt tutorial

- replaced new_graph.nodes with dev.wires to clairfy
iteration over wires

* Update demonstrations/tutorial_coherent_vqls.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/qsim_beyond_classical.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/tutorial_coherent_vqls.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/tutorial_mol_geo_opt.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/tutorial_qaoa_intro.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/tutorial_vqe_qng.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/tutorial_vqls.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/tutorial_mol_geo_opt.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update demonstrations/tutorial_qaoa_maxcut.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Address comments

- made circuit a qnode to prevent the need to initialize multiple
qnodes one after another

Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: Maria Schuld <mariaschuld@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update tutorial_gbs.py (#351)

* pin pyparsing (#358)

* Merge `master` into `dev` (#362)

* Update pyscf version. (#273)

Co-authored-by: Olivia Di Matteo <dimatteo.olivia@gmail.com>

* Update qnode.draw to qml.draw() (#352)

* pin pyparsing (#357)

* replaced pad --> pad_with in this tutorial as it has now been deprecated (#359)

* Add an action for demo output checking (#356)

* Update demos to make use of the new qml.sample and qml.expval(H) functionality (story #: 8118)  (#330)

* Updated qsim to use the new qml.sample functionality
**needs to be tested ! **

* just removed one commented line

* Updated one of the paragraphs to be consistent with
the changes

* Updated coherent vqls to use the builtin functionality of
qml.sample, also tested it locally and it seems to run without
errors!

* updated qaoa_maxcut to use new qml.sample functionality

* updated vqls tutorial to make  use of the new functionality
of qml.sample

* Made some changes to chem reaction tutorial, want to confirm with
CI to see if it works properly because I can't run it locally

* fixed quick little bug with wires in circuit def

* quick change to help debug error in CI

* Found the bug with chem_reactions tutorial, hopefully
this fixes it

* updated falqon tutorial and removed dependance on qml.ExpvalCost,
still need to confirm it works with CI

* fixed a small bug, wrote Qnode isntead of QNode

* Updated falqon to use qml.expval instead of qml.ExpvalCost

* updated optimized measurement tutorial to make use of qml.expval,
still need to test with CI

* debugging measurement optimize tutorial

* The bug regarding Qnodes is well known, just made a change
the Christina suggested as a temporary fix

* Updated molecular geometry optimization tutorial to make
use of qml.expval

* Updated qaoa tutorial to make use of qml.expval, updated docs
in both examples to remove qml.ExpValCost

* Updated vqe and vqe qng tutorials to use qml.expval(H)

* Updated the vqe soin sectors demo with qml.expval, fixed a typo in
overview of vqe tutorial

* Updated parallel vqe tutorial to remove dependance on qml.ExpvalCost,
was not able to fully test this because I don't have rigitti setup

* Updated these tutorials to remove qml.ExpvalCost dependance

* Cleaning up some typos and comments

* Updated measurement optimization tutorial to make use of qml.Tracker

* Update demonstrations/tutorial_qaoa_maxcut.py

Co-authored-by: antalszava <antalszava@gmail.com>

* Update demonstrations/qsim_beyond_classical.py

Co-authored-by: antalszava <antalszava@gmail.com>

* Update demonstrations/tutorial_coherent_vqls.py

Co-authored-by: antalszava <antalszava@gmail.com>

* Updated tutorials based on pr comments

* Fixed bug in the spsa demo

* clean up

* Update demonstrations/tutorial_qaoa_maxcut.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* cleaned up docs

* Cleaning up documentation

* added comment

* Update demonstrations/braket-parallel-gradients.py

Co-authored-by: antalszava <antalszava@gmail.com>

* Clean up

- added variable num_wires to mol_geo_opt tutorial

- replaced new_graph.nodes with dev.wires to clairfy
iteration over wires

* Update demonstrations/tutorial_coherent_vqls.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/qsim_beyond_classical.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/tutorial_coherent_vqls.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/tutorial_mol_geo_opt.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/tutorial_qaoa_intro.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/tutorial_vqe_qng.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/tutorial_vqls.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/tutorial_mol_geo_opt.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update demonstrations/tutorial_qaoa_maxcut.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Address comments

- made circuit a qnode to prevent the need to initialize multiple
qnodes one after another

Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: Maria Schuld <mariaschuld@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>

* sources + yml

* add diff job

* on push

* branch name

* unzip with path

* updates

* tutorials from master and dev too

* path to script

* Update diffs found

* add toc and references

* Update diffs found

* comments

* mv to .github/workflows dedicated folder

* diffs document updates

* revert changes to tutorial_vqe_qng.py

* Update .github/workflows/html_parser.py

Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>

* suggestions

* no sys

* Move demo_diff.md so that workflows access is not required

* change trigger and branch

Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
Co-authored-by: Maria Schuld <mariaschuld@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: QML demo checker Bot <>

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>
Co-authored-by: Olivia Di Matteo <dimatteo.olivia@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update templates access and remove template decorator (#360)

* Update pyscf version. (#273)

Co-authored-by: Olivia Di Matteo <dimatteo.olivia@gmail.com>

* Update qnode.draw to qml.draw() (#352)

* pin pyparsing (#357)

* replaced pad --> pad_with in this tutorial as it has now been deprecated (#359)

* Update templates.

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>
Co-authored-by: Olivia Di Matteo <dimatteo.olivia@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>

* Remove use of the init module everywhere (#361)

* Update pyscf version. (#273)

Co-authored-by: Olivia Di Matteo <dimatteo.olivia@gmail.com>

* Update qnode.draw to qml.draw() (#352)

* pin pyparsing (#357)

* replaced pad --> pad_with in this tutorial as it has now been deprecated (#359)

* Add an action for demo output checking (#356)

* Update demos to make use of the new qml.sample and qml.expval(H) functionality (story #: 8118)  (#330)

* Updated qsim to use the new qml.sample functionality
**needs to be tested ! **

* just removed one commented line

* Updated one of the paragraphs to be consistent with
the changes

* Updated coherent vqls to use the builtin functionality of
qml.sample, also tested it locally and it seems to run without
errors!

* updated qaoa_maxcut to use new qml.sample functionality

* updated vqls tutorial to make  use of the new functionality
of qml.sample

* Made some changes to chem reaction tutorial, want to confirm with
CI to see if it works properly because I can't run it locally

* fixed quick little bug with wires in circuit def

* quick change to help debug error in CI

* Found the bug with chem_reactions tutorial, hopefully
this fixes it

* updated falqon tutorial and removed dependance on qml.ExpvalCost,
still need to confirm it works with CI

* fixed a small bug, wrote Qnode isntead of QNode

* Updated falqon to use qml.expval instead of qml.ExpvalCost

* updated optimized measurement tutorial to make use of qml.expval,
still need to test with CI

* debugging measurement optimize tutorial

* The bug regarding Qnodes is well known, just made a change
the Christina suggested as a temporary fix

* Updated molecular geometry optimization tutorial to make
use of qml.expval

* Updated qaoa tutorial to make use of qml.expval, updated docs
in both examples to remove qml.ExpValCost

* Updated vqe and vqe qng tutorials to use qml.expval(H)

* Updated the vqe soin sectors demo with qml.expval, fixed a typo in
overview of vqe tutorial

* Updated parallel vqe tutorial to remove dependance on qml.ExpvalCost,
was not able to fully test this because I don't have rigitti setup

* Updated these tutorials to remove qml.ExpvalCost dependance

* Cleaning up some typos and comments

* Updated measurement optimization tutorial to make use of qml.Tracker

* Update demonstrations/tutorial_qaoa_maxcut.py

Co-authored-by: antalszava <antalszava@gmail.com>

* Update demonstrations/qsim_beyond_classical.py

Co-authored-by: antalszava <antalszava@gmail.com>

* Update demonstrations/tutorial_coherent_vqls.py

Co-authored-by: antalszava <antalszava@gmail.com>

* Updated tutorials based on pr comments

* Fixed bug in the spsa demo

* clean up

* Update demonstrations/tutorial_qaoa_maxcut.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* cleaned up docs

* Cleaning up documentation

* added comment

* Update demonstrations/braket-parallel-gradients.py

Co-authored-by: antalszava <antalszava@gmail.com>

* Clean up

- added variable num_wires to mol_geo_opt tutorial

- replaced new_graph.nodes with dev.wires to clairfy
iteration over wires

* Update demonstrations/tutorial_coherent_vqls.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/qsim_beyond_classical.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/tutorial_coherent_vqls.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/tutorial_mol_geo_opt.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/tutorial_qaoa_intro.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/tutorial_vqe_qng.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/tutorial_vqls.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* Update demonstrations/tutorial_mol_geo_opt.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update demonstrations/tutorial_qaoa_maxcut.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Address comments

- made circuit a qnode to prevent the need to initialize multiple
qnodes one after another

Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: Maria Schuld <mariaschuld@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>

* sources + yml

* add diff job

* on push

* branch name

* unzip with path

* updates

* tutorials from master and dev too

* path to script

* Update diffs found

* add toc and references

* Update diffs found

* comments

* mv to .github/workflows dedicated folder

* diffs document updates

* revert changes to tutorial_vqe_qng.py

* Update .github/workflows/html_parser.py

Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>

* suggestions

* no sys

* Move demo_diff.md so that workflows access is not required

* change trigger and branch

Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
Co-authored-by: Maria Schuld <mariaschuld@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: QML demo checker Bot <>

* remove init module everywhere

* minor improvement

* add 2pi scaling

* Update demonstrations/spsa.py

Co-authored-by: antalszava <antalszava@gmail.com>

* Update demonstrations/tutorial_doubly_stochastic.py

Co-authored-by: antalszava <antalszava@gmail.com>

* add low and high; scale argument

* add low and high; scale argument

* use pad_with

Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>
Co-authored-by: Olivia Di Matteo <dimatteo.olivia@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>

* Requires grad updates (#364)

* chemical

* tutorial_mol_geo_opt

* tutorial_vqe_spin_sectors

* vqe; remove - option due to redundancy warning

* rotoselect

* natural grad demo

* qgrnn

* local cost func demo, requires_grad=True

* format

* gaussian transformation

* qaoa intro

* adaptive

* variational classifier

* Update demonstr…
  • Loading branch information
23 people committed Dec 14, 2021
1 parent fc2817b commit 14e1925
Show file tree
Hide file tree
Showing 24 changed files with 249 additions and 81 deletions.
20 changes: 4 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ orbs:
jobs:
build:
docker:
- image: circleci/python:3.7.2
- image: rigetti/quilc
command:
- -R
- image: rigetti/qvm
command:
- -S
- image: circleci/python:3.7.12

steps:
- checkout
Expand All @@ -30,7 +24,7 @@ jobs:
sudo apt install pandoc -qq
python3 -m venv venv
. venv/bin/activate
pip install pip setuptools --upgrade
pip install pip setuptools cmake --upgrade
pip install -r requirements.txt
pip install --no-deps -r requirements_no_deps.txt
Expand Down Expand Up @@ -86,13 +80,7 @@ jobs:

build_dev:
docker:
- image: circleci/python:3.7.2
- image: rigetti/quilc
command:
- -R
- image: rigetti/qvm
command:
- -S
- image: circleci/python:3.7.12

steps:
- checkout
Expand All @@ -102,7 +90,7 @@ jobs:
command: |
python3 -m venv venv
. venv/bin/activate
pip install pip setuptools --upgrade
pip install pip setuptools cmake --upgrade
pip install -r requirements.txt
pip install --no-deps -r requirements_no_deps.txt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
tutorial_variational_classifier Variational quantum classifier
*Author: PennyLane dev team. Last updated: 6 Aug 2020.*
*Author: PennyLane dev team. Last updated: 13 Dec 2021.*
This tutorial outlines how two QPUs can be combined in parallel to help solve a machine learning
classification problem.
Expand Down Expand Up @@ -134,6 +134,12 @@ def plot_points(x_train, y_train, x_test, y_test):

plot_points(x_train, y_train, x_test, y_test)

##############################################################################
# .. figure:: /demonstrations/ensemble_multi_qpu/ensemble_multi_qpu_001.png
# :width: 80%
# :align: center
#

##############################################################################
# This plot shows us that class 0 points can be nicely separated, but that there is an overlap
# between points from classes 1 and 2.
Expand All @@ -155,7 +161,7 @@ def plot_points(x_train, y_train, x_test, y_test):
# prediction.
#
# .. figure:: /demonstrations/ensemble_multi_qpu/ensemble_diagram.png
# :width: 50%
# :width: 80%
# :align: center
#
# Quantum nodes
Expand All @@ -179,7 +185,7 @@ def plot_points(x_train, y_train, x_test, y_test):
# .. warning::
# Rigetti's QVM and Quil Compiler services must be running for this tutorial to execute. They
# can be installed by consulting the `Rigetti documentation
# <http://docs.rigetti.com/en/stable/>`__ or, for users with Docker, by running:
# <http://docs.rigetti.com/qcs/>`__ or, for users with Docker, by running:
#
# .. code-block:: bash
#
Expand All @@ -189,7 +195,7 @@ def plot_points(x_train, y_train, x_test, y_test):
# The circuits for both QPUs are shown in the figure below:
#
# .. figure:: /demonstrations/ensemble_multi_qpu/diagram_circuits.png
# :width: 50%
# :width: 80%
# :align: center


Expand Down Expand Up @@ -298,6 +304,30 @@ def predict(params, x=None, parallel=True):
print("Predicting on test dataset")
p_test, p_test_0, p_test_1, choices_test = predict(params, x=x_test)

##############################################################################
# .. rst-class:: sphx-glr-script-out
#
# Out:
#
# .. code-block:: none
#
# Predicting on training dataset
# Completed up to iteration 10
# Completed up to iteration 20
# Completed up to iteration 30
# Completed up to iteration 40
# Completed up to iteration 50
# Completed up to iteration 60
# Completed up to iteration 70
# Completed up to iteration 80
# Completed up to iteration 90
# Completed up to iteration 100
# Completed up to iteration 110
# Completed up to iteration 120
# Predicting on test dataset
# Completed up to iteration 10
# Completed up to iteration 20

##############################################################################
# Analyze performance
# -------------------
Expand All @@ -324,11 +354,34 @@ def accuracy(predictions, actuals):
print("Training accuracy (QPU0): {}".format(accuracy(p_train_0, y_train)))
print("Training accuracy (QPU1): {}".format(accuracy(p_train_1, y_train)))

##############################################################################
# .. rst-class:: sphx-glr-script-out
#
# Out:
#
# .. code-block:: none
#
# Training accuracy (ensemble): 0.824
# Training accuracy (QPU0): 0.648
# Training accuracy (QPU1): 0.28

##############################################################################

print("Test accuracy (ensemble): {}".format(accuracy(p_test, y_test)))
print("Test accuracy (QPU0): {}".format(accuracy(p_test_0, y_test)))
print("Test accuracy (QPU1): {}".format(accuracy(p_test_1, y_test)))

##############################################################################
# .. rst-class:: sphx-glr-script-out
#
# Out:
#
# .. code-block:: none
#
# Test accuracy (ensemble): 0.72
# Test accuracy (QPU0): 0.56
# Test accuracy (QPU1): 0.24

##############################################################################
# These numbers tell us a few things:
#
Expand Down Expand Up @@ -357,6 +410,20 @@ def accuracy(predictions, actuals):
print("Choices: {}".format(choices))
print("Choices counts: {}".format(Counter(choices)))

##############################################################################
# .. rst-class:: sphx-glr-script-out
#
# Out:
#
# .. code-block:: none
#
# Choices: [0 0 1 1 0 0 1 0 0 0 1 0 0 0 0 0 0 1 1 0 0 1 0 1 1 0 0 0 1 0 0 1 0 1 0 0 0
# 0 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0
# 0 0 0 0 0 1 1 1 1 0 0 0 1 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0
# 1 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 0 1 0 0
# 0 0]
# Choices counts: Counter({0: 110, 1: 40})

##############################################################################
# The following lines keep track of choices and corresponding predictions in the ensemble model.

Expand All @@ -380,6 +447,21 @@ def accuracy(predictions, actuals):
print("\n" + expl.format("1", Counter(predictions_1)))
print("\nDistribution of classes in iris dataset: {}".format(Counter(y)))

##############################################################################
# .. rst-class:: sphx-glr-script-out
#
# Out:
#
# .. code-block:: none
#
# When QPU0 was chosen by the ensemble, it made the following distribution of predictions:
# Counter({0: 55, 2: 55})
#
# When QPU1 was chosen by the ensemble, it made the following distribution of predictions:
# Counter({1: 37, 0: 3})
#
# Distribution of classes in iris dataset: Counter({0: 50, 2: 50, 1: 50})

##############################################################################
# These results show us that QPU0 specializes to making predictions on classes 0 and 2,
# while QPU1 specializes to class 1.
Expand Down Expand Up @@ -445,14 +527,32 @@ def plot_points_prediction(x, y, p, title):

plot_points_prediction(x, y, predictions, "ensemble") # ensemble

##############################################################################
# .. figure:: /demonstrations/ensemble_multi_qpu/ensemble_multi_qpu_002.png
# :width: 80%
# :align: center
#

##############################################################################

plot_points_prediction(x, y, np.append(p_train_0, p_test_0), "QPU0") # QPU 0

##############################################################################
# .. figure:: /demonstrations/ensemble_multi_qpu/ensemble_multi_qpu_003.png
# :width: 80%
# :align: center
#

##############################################################################

plot_points_prediction(x, y, np.append(p_train_1, p_test_1), "QPU1") # QPU 1

##############################################################################
# .. figure:: /demonstrations/ensemble_multi_qpu/ensemble_multi_qpu_004.png
# :width: 80%
# :align: center
#

##############################################################################
# These plots reinforce the specialization of the two QPUs. QPU1 concentrates on doing a good job
# at predicting class 1, while QPU0 is focused on classes 0 and 2. By combining together,
Expand Down
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.
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.
5 changes: 2 additions & 3 deletions demonstrations/qonn.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,7 @@ def cost_wrapper(var, grad=[]):
##############################################################################
# We can also print the circuit to see how the final network looks.

quantum_neural_net(var_init, X[0])
print(quantum_neural_net.draw())
print(qml.draw(quantum_neural_net)(var_init, X[0]))

##############################################################################
# .. rst-class:: sphx-glr-script-out
Expand All @@ -463,4 +462,4 @@ def cost_wrapper(var, grad=[]):
# 2: ──|1⟩──╭BS(5.99, -3.25)──╰BS(-1.51, -2.28)──╭BS(-2.99, -2.97)──╰BS(-2.27, -0.741)──╭BS(-4.8, 1.38)──R(0)────────Kerr(1.57)──╭BS(4.57, -4.12)──╰BS(4.57, 4.65)──╭BS(2.01, 2.31)──╰BS(2.96, 2.15)──╭BS(-3.48, 1.4)──R(0)────────Kerr(1.57)──┤ ⟨n⟩
# 3: ──|0⟩──╰BS(5.99, -3.25)─────────────────────╰BS(-2.99, -2.97)──────────────────────╰BS(-4.8, 1.38)──R(0)────────Kerr(1.57)──╰BS(4.57, -4.12)───────────────────╰BS(2.01, 2.31)───────────────────╰BS(-3.48, 1.4)──R(0)────────Kerr(1.57)──┤ ⟨n⟩
#

#
31 changes: 12 additions & 19 deletions demonstrations/tutorial_backprop.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"""
import pennylane as qml
from pennylane import numpy as np
from matplotlib import pyplot as plt

# set the random seed
np.random.seed(42)
Expand Down Expand Up @@ -91,7 +92,8 @@ def circuit(params):
##############################################################################
# We can also draw the executed quantum circuit:

print(qml.draw(circuit)(params))
fig, ax = qml.draw_mpl(circuit, decimals=2)(params)
plt.show()


##############################################################################
Expand Down Expand Up @@ -160,25 +162,18 @@ def parameter_shift(qnode, params):
# ~~~~~~~~~~~~
#
# Let's consider an example with a significantly larger number of parameters.
# We'll make use of the :class:`~pennylane.templates.StronglyEntanglingLayers` template
# We'll make use of the :class:`~pennylane.StronglyEntanglingLayers` template
# to make a more complicated QNode.

dev = qml.device("default.qubit", wires=4)

@qml.qnode(dev, diff_method="parameter-shift", mutable=False)
@qml.qnode(dev, diff_method="parameter-shift")
def circuit(params):
qml.StronglyEntanglingLayers(params, wires=[0, 1, 2, 3])
return qml.expval(qml.PauliZ(0) @ qml.PauliZ(1) @ qml.PauliZ(2) @ qml.PauliZ(3))


##############################################################################
# Note that we specify that the QNode is **immutable**. This is more restrictive than a standard
# mutable QNode (the quantum circuit structure cannot change/differ between executions); however, it
# reduces processing overhead.


# initialize circuit parameters
param_shape = qml.templates.StronglyEntanglingLayers.shape(n_wires=4, n_layers=15)
param_shape = qml.StronglyEntanglingLayers.shape(n_wires=4, n_layers=15)
params = np.random.normal(scale=0.1, size=param_shape, requires_grad=True)
print(params.size)
print(circuit(params))
Expand All @@ -203,7 +198,6 @@ def circuit(params):

# create the gradient function
grad_fn = qml.grad(circuit)
circuit.qtape = None

times = timeit.repeat("grad_fn(params)", globals=globals(), number=num, repeat=reps)
backward_time = min(times) / num
Expand Down Expand Up @@ -276,7 +270,7 @@ def circuit(params):
return qml.expval(qml.PauliZ(0) @ qml.PauliZ(1) @ qml.PauliZ(2) @ qml.PauliZ(3))

# initialize circuit parameters
param_shape = qml.templates.StronglyEntanglingLayers.shape(n_wires=4, n_layers=15)
param_shape = qml.StronglyEntanglingLayers.shape(n_wires=4, n_layers=15)
params = np.random.normal(scale=0.1, size=param_shape, requires_grad=True)
print(circuit(params))

Expand Down Expand Up @@ -335,15 +329,15 @@ def circuit(params):
gradient_backprop = []

for depth in range(0, 21):
param_shape = qml.templates.StronglyEntanglingLayers.shape(n_wires=4, n_layers=depth)
param_shape = qml.StronglyEntanglingLayers.shape(n_wires=4, n_layers=depth)
params = np.random.normal(scale=0.1, size=param_shape, requires_grad=True)
num_params = params.size

# forward pass timing
# ===================

qnode_shift = qml.QNode(circuit, dev, diff_method="parameter-shift", mutable=False)
qnode_backprop = qml.QNode(circuit, dev, diff_method="backprop", mutable=False)
qnode_shift = qml.QNode(circuit, dev, diff_method="parameter-shift")
qnode_backprop = qml.QNode(circuit, dev, diff_method="backprop")

# parameter-shift
t = timeit.repeat("qnode_shift(params)", globals=globals(), number=num, repeat=reps)
Expand All @@ -359,8 +353,8 @@ def circuit(params):
# Gradient timing
# ===============

qnode_shift = qml.QNode(circuit, dev, diff_method="parameter-shift", mutable=False)
qnode_backprop = qml.QNode(circuit, dev, diff_method="backprop", mutable=False)
qnode_shift = qml.QNode(circuit, dev, diff_method="parameter-shift")
qnode_backprop = qml.QNode(circuit, dev, diff_method="backprop")

# parameter-shift
t = timeit.repeat("qml.grad(qnode_shift)(params)", globals=globals(), number=num, repeat=reps)
Expand All @@ -378,7 +372,6 @@ def circuit(params):
##############################################################################
# We now import matplotlib, and plot the results.

from matplotlib import pyplot as plt
plt.style.use("bmh")

fig, ax = plt.subplots(1, 1, figsize=(6, 4))
Expand Down
6 changes: 3 additions & 3 deletions demonstrations/tutorial_classical_shadows.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def calculate_classical_shadow(circuit_template, params, shadow_size, num_qubits
dev = qml.device("default.qubit", wires=num_qubits, shots=1)

# simple circuit to prepare rho
@qml.qnode(device=dev)
@qml.qnode(dev)
def local_qubit_rotation_circuit(params, **kwargs):
observables = kwargs.pop("observable")
for w in dev.wires:
Expand Down Expand Up @@ -355,7 +355,7 @@ def shadow_state_reconstruction(shadow):

# circuit to create a Bell state and measure it in
# the bases specified by the 'observable' keyword argument.
@qml.qnode(device=dev)
@qml.qnode(dev)
def bell_state_circuit(params, **kwargs):
observables = kwargs.pop("observable")

Expand Down Expand Up @@ -582,7 +582,7 @@ def shadow_bound(error, observables, failure_rate=0.01):
dev = qml.device("default.qubit", wires=num_qubits, shots=1)


@qml.qnode(device=dev)
@qml.qnode(dev)
def circuit(params, **kwargs):
observables = kwargs.pop("observable")
for w in range(num_qubits):
Expand Down
Loading

0 comments on commit 14e1925

Please sign in to comment.