Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tutorial for qubit tapering #413

Merged
merged 295 commits into from
May 16, 2022
Merged

Add tutorial for qubit tapering #413

merged 295 commits into from
May 16, 2022

Conversation

soranjh
Copy link
Contributor

@soranjh soranjh commented Dec 23, 2021

Title:
Qubit tapering

Summary:
Adds a tutorial for using the qubit tapering functionality of PennyLane. The tutorial explains the theory and showcases a step-by-step workflow to generate symmetry operators, apply them to a molecular Hamiltonian such that it acts trivially on some qubits and taper-off those qubits by replacing them with a set of generated optimal eigenvalues. The resulting Hamiltonian acts on a fewer number of qubits. The process of reducing the number of qubits in the reference Hartree-Fock state is also explained.

Relevant references:
https://github.com/PennyLaneAI/adrs/blob/master/documents/051-qubit-reduction.rst
https://arxiv.org/abs/1701.08213
https://arxiv.org/abs/1910.14644

actions-user and others added 30 commits August 17, 2021 06:20
* plt.show; last updated

* Model name
* 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
Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: antalszava <antalszava@gmail.com>
…tionality (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 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 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>
* 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>
* 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 demonstrations/tutorial_local_cost_functions.py

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

* update with assignment

* suggestion + requires_grad specify

* qonn.py

Co-authored-by: Christina Lee <christina@xanadu.ai>
@soranjh soranjh changed the base branch from dev to master May 4, 2022 17:20
demonstrations/tutorial_qubit_tapering.py Outdated Show resolved Hide resolved
demonstrations/tutorial_qubit_tapering.py Show resolved Hide resolved
demonstrations/tutorial_qubit_tapering.py Outdated Show resolved Hide resolved
demonstrations/tutorial_qubit_tapering.py Show resolved Hide resolved
Co-authored-by: Josh Izaac <josh146@gmail.com>
@CatalinaAlbornoz CatalinaAlbornoz merged commit cda04ac into master May 16, 2022
@CatalinaAlbornoz CatalinaAlbornoz deleted the qubit_tapering branch May 16, 2022 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.