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 hardware-efficient particle-conserving ansatz U2 #876

Merged
merged 38 commits into from
Nov 18, 2020

Conversation

soranjh
Copy link
Contributor

@soranjh soranjh commented Oct 29, 2020

Context:
Add a hardware-efficient particle-conserving ansatz for VQE-based Quantum Chemistry simulations. See Fig. 2(b) in https://arxiv.org/abs/1805.04340.

Description of the Change:
The function ParticleConservingU2 has been implemented in the file ./templates/layers/particle_conserving_u2.py.

Benefits:
Add a new template that can be used with PL-QChem for QChem simulations.

Possible Drawbacks:
None

Related GitHub Issues:
None

@soranjh soranjh self-assigned this Oct 29, 2020
@soranjh soranjh added qchem ⚛️ Related to the QChem package WIP 🚧 Work-in-progress templates 📁 Updates and additions to the templates and removed qchem ⚛️ Related to the QChem package labels Oct 29, 2020
@codecov
Copy link

codecov bot commented Oct 29, 2020

Codecov Report

Merging #876 (e3d0eba) into master (bbb6fb6) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #876   +/-   ##
=======================================
  Coverage   97.85%   97.86%           
=======================================
  Files         145      146    +1     
  Lines        9932     9973   +41     
=======================================
+ Hits         9719     9760   +41     
  Misses        213      213           
Impacted Files Coverage Δ
pennylane/init.py 100.00% <100.00%> (ø)
pennylane/templates/layers/__init__.py 100.00% <100.00%> (ø)
...nnylane/templates/layers/particle_conserving_u2.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bbb6fb6...e3d0eba. Read the comment docs.

@soranjh soranjh added review-ready 👌 PRs which are ready for review by someone from the core team. and removed WIP 🚧 Work-in-progress labels Nov 6, 2020
doc/introduction/templates.rst Show resolved Hide resolved
pennylane/init.py Outdated Show resolved Hide resolved
pennylane/init.py Outdated Show resolved Hide resolved
pennylane/init.py Outdated Show resolved Hide resolved
pennylane/templates/layers/particle_conserving_u2.py Outdated Show resolved Hide resolved
pennylane/templates/layers/particle_conserving_u2.py Outdated Show resolved Hide resolved
pennylane/templates/layers/particle_conserving_u2.py Outdated Show resolved Hide resolved
pennylane/templates/layers/particle_conserving_u2.py Outdated Show resolved Hide resolved
pennylane/templates/layers/particle_conserving_u2.py Outdated Show resolved Hide resolved
tests/test_init.py Show resolved Hide resolved
Copy link
Contributor

@agran2018 agran2018 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @soranjh!. Please, check my comments below.

doc/introduction/templates.rst Show resolved Hide resolved
pennylane/templates/layers/particle_conserving_u2.py Outdated Show resolved Hide resolved
pennylane/templates/layers/particle_conserving_u2.py Outdated Show resolved Hide resolved
pennylane/templates/layers/particle_conserving_u2.py Outdated Show resolved Hide resolved
pennylane/templates/layers/particle_conserving_u2.py Outdated Show resolved Hide resolved
pennylane/templates/layers/particle_conserving_u2.py Outdated Show resolved Hide resolved
pennylane/templates/layers/particle_conserving_u2.py Outdated Show resolved Hide resolved
pennylane/templates/layers/particle_conserving_u2.py Outdated Show resolved Hide resolved
pennylane/templates/layers/particle_conserving_u2.py Outdated Show resolved Hide resolved
.github/CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@agran2018 agran2018 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @soranjh. Thanks!.

@soranjh soranjh merged commit 219a8f4 into master Nov 18, 2020
@soranjh soranjh deleted the hardware-efficient-ansatz-u2 branch November 18, 2020 16:06
alejomonbar pushed a commit to alejomonbar/pennylane that referenced this pull request Dec 1, 2020
antalszava added a commit that referenced this pull request Dec 9, 2020
* Test for comparing different devices with the default device

* Update test_compare_default_qubit.py with the suggestions of Pennylane team

* Test for comparing different devices with the default device

* Update test_compare_default_qubit.py with the suggestions of Pennylane team

* Enable tape mode in tests (#859)

* backup

* add fixture

* polish

* polish2

* Update tests/templates/test_integration.py

* add execution property to Device class for tracking the number of device executions over a QNodes lifetime (#853)

* add execution property to Device class for tracking the number of device executions over a QNodes lifetime, add unit tests for tracking device executions

* reformat files with black, update execution to num_executions, reformat existing exceptions, update num_executions docstring

* Fix typo in test_device_executions docstring

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

* move _num_executions counter to execute() method for _device and _qubit_device, move corresponding unit tests to appropriate locations

* update CHANGELOG.md to include num_executions

* Add Anthony Hayes to list of contributers in CHANGEOG.md

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>
Co-authored-by: Nathan Killoran <co9olguy@users.noreply.github.com>
Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>

* Adds handling of single-qubit Paulis and all-identity Pauli to PauliRot operation.  (#860)

* Fix PauliRot to work for single-qubit case with int-specified wire.

* Fix matrix construction for all-identity Pauli.

* Ensure PauliRot decomposition handles all-identity case.

* Adds tests for single-qubit PauliRot matrix, and identity decomp.

* Updated changelog.

* Removed single-qubit matrix test since this was not the original single-qubit issue.

* Added PR link to changelog.

* Run black formatting.

* Run black through command line.

* Update .github/CHANGELOG.md

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

* Reverted stuff that was reformatted by emacs black.

* Fixes decomposition to also handle integer wires.

* Update codecov.yml

* Fixed eigvals to work for all-identity case, and updated tests.

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

* Updating collections and VQECost to work in tape mode (#863)

* backup

* add fixture

* polish

* polish2

* Update tests/templates/test_integration.py

* [WIP] Updating collections to work in tape mode

* more

* black and linting

* skip test with race condition

* Add VQECost support

* add more tests

* update changelog

* Update pennylane/collections/map.py

* Update pennylane/tape/__init__.py

* suggested changes

* suggested changes

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

* Build many-body observables in PL-QChem using FermionOperator data structure (#854)

* Modify the 'observable' function to build PL observables from a list of FermionOperators

* Modify unit tests for the 'observable' function

* Modify functions 'one_particle' and 'two_particle' to build FermionOperators

* Modify unit tests for 'one_particle' function

* Polish 'one_particle' and 'two_particle' functions

* Modify unit test for the 'two_particle' and 'one_particle' functions

* Add missing contribution due to core orbitals to the 'two_particle' function

* Modify unit tests for 'two_particle' function

* Update 'CHANGELOG.md'

* Remove trailing spaces

* Update 'CHANGELOG.md'

* Polish docstrings

* Apply suggestions from code review

* Polsih the docstring of 'observable'

* Adds basic resource estimation to quantum tapes. (#862)

* Adds resource estimation and depth to quantum tape. (Untested.)

* Fixed depth calculation to include only observables. Added tests.

* Add new feature to changelog.

* Run black.

* Change accessing of graph to satisfy CodeFactor.

* Update pennylane/tape/circuit_graph.py

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

* Update pennylane/tape/circuit_graph.py

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

* Update pennylane/tape/tapes/tape.py

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

* Added usage examples to code doc strings.

* Fixed typo.

* Replaced truncated graph by operation subgraph.

* Full replacement of truncated graph with operation graph.

* Change default values of depth to None, adjust tests.

* Update .github/CHANGELOG.md

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

* Update pennylane/tape/circuit_graph.py

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

* Update pennylane/tape/circuit_graph.py

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

* Switch from properties to methods for resource estimation.

* Update pennylane/tape/circuit_graph.py

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

Co-authored-by: Olivia Di Matteo <dimatteo.olivia@gmail.com>
Co-authored-by: Nathan Killoran <co9olguy@users.noreply.github.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>

* Updating qnn.TorchLayer to work in tape mode (#865)

* backup

* add fixture

* polish

* polish2

* Update tests/templates/test_integration.py

* [WIP] Updating collections to work in tape mode

* more

* black and linting

* skip test with race condition

* Add VQECost support

* add more tests

* Updating qnn.TorchLayer to work in tape mode

* update changelog

* fixes

* fixes

* Apply suggestions from code review

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

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>
Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>
Co-authored-by: Nathan Killoran <co9olguy@users.noreply.github.com>

* Updating qnn.KerasLayer to work in tape mode (#869)

* Update qnn.keras for tape mode

* Add tape mode evaluate

* Work on tests

* Update qnode

* Tests working

* Update changelog

* Fix weird behaviour

* Remove extra attribute

* Add support for backprop

* Apply suggestions from code review

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

* Apply suggestions

* merge master

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

* Make caching compatible with batch execution (#851)

* dummy change

* rewrite num_diff method internally

* undo dummy change needed to open pr

* more

* use deep copy

* rewrite param shift method

* more

* more

* backup

* polish param shift method

* docs

* backup

* typos

* backup

* make postprocessing of finite diff depend on order

* fix operation copies

* backup

* attempt to fix tests

* fixing tests

* temporarily fix copying

* finish param shift var

* blacking the code

* blacking the code

* pylint

* fix black

* fix black

* test black

* black

* fix function naming

* all bugs fixed but inverse

* Revert "fix function naming"

This reverts commit c8eb906.

* struggling with tape construction using inverse gates

* try to get reversible to work

* reversible tape working

* refactor cv param shift (expval) method

* remove middle functions in cv param shift -> now variance test failing to call them

* port CV var

* linting

* basic rewrite of jacobian loop

* rewrite jacobian loop

* test jacobian tape passing

* working parameter shift tests

* CV tests passing

* reversible tape working

* all tests passing

* linting

* use a flat tape list

* black

* add batch_execute functions to device and qubit_device

* black

* backup

* docstrings

* remove deepcopying (#845)

* polish

* docstrings

* polishing

* linting

* Update pennylane/operation.py

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

* Update pennylane/operation.py

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

* Update pennylane/tape/tapes/qubit_param_shift.py

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

* Update pennylane/tape/tapes/reversible.py

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

* make tests pass

* add test for batch_execute

* polish

* polish2

* skip tests if interface not imported

* fix test

* Update pennylane/_device.py

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

* update copy semantics

* Josh review

* Update pennylane/tape/tapes/reversible.py

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

* more

* suggested changes

* suggested changes

* Update pennylane/tape/tapes/reversible.py

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

* suggested changes

* added copying tests

* more copying tests

* another test

* Update pennylane/tape/tapes/reversible.py

* Update pennylane/tape/tapes/cv_param_shift.py

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

* backup

* reset fix implemented, still 4 cache tests not passing

* backup

* improve tests

* Use caching in device

* polisg

* Add argument

* Update devs

* Fix jacobian tape

* Fix tests

* Remove extra test

* Only allow caching in tape mode

* Update test docstring

* Move

* Update tests

* Prevent use in backprop mode

* Update changelog

* Update TODO

* Update docstring

* Apply black

* Fix test

* Apply black

* Remove tests and update docstrings

* Update changelog

* Minor improvements

* Remove unused import

* Remove mention of caching in changelog

* Apply suggestions from code review

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

* Update changelog

* Rename caching to cache in qubit device

* Rename caching to cache

* Remove extra methods

* Update docstrings

* Apply suggestion

* Remove extra caching line

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Nathan Killoran <co9olguy@users.noreply.github.com>
Co-authored-by: antalszava <antalszava@gmail.com>

* Add the sqrt X gate (#871)

* Add the sqrt X (SX) gate

Issue #868

* Add inverse and fix docs spacing

inverse still isn't testing correctly

* fixing matrix vrs _matrix

* edit changelog

* edit changelog

* grammar fix

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

* another typo

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

* switch decomposition order

* Update .github/CHANGELOG.md

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

* Update .github/CHANGELOG.md

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

* Apply suggestions from code review

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

* add to default_mixed, test default_qubit, test decomposition

* Update .github/CHANGELOG.md

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>

* Small update in DisplacementEmbedding docstring (#879)

* Update displacement.py

* Update pennylane/templates/embeddings/displacement.py

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

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

* Update the templates quickstart (#880)

* default_qubit to use the hard-coded inverses (#872)

* default_qubit to use the hard-coded inverses

Issue #870

* Add to changelog

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

* Add representation to MeasurementProcess (#883)

* add repr method

* fix a test

* polish

* Update pennylane/tape/measure.py

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

* Update pennylane/tape/measure.py

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

* Use dense matrices in mottonen state preparation (#864)

* backup

* refactor

* refactor complete

* add angle equation

* polish

* polish

* simplify code more

* black

* polish equation

* Update pennylane/templates/state_preparations/mottonen.py

* Update pennylane/templates/state_preparations/mottonen.py

* Update pennylane/templates/state_preparations/mottonen.py

* reverse wires

* docstrings

* backup

* update qasm

* make all test run

* docstring polish

* backup

* make tests pass

* black

* typo

* one more typo

* delete unused import

* Update pennylane/templates/state_preparations/mottonen.py

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

* Update pennylane/templates/state_preparations/mottonen.py

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

* Update pennylane/templates/state_preparations/mottonen.py

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

* polish

* Update pennylane/templates/state_preparations/mottonen.py

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

* Update tests/templates/test_state_preparations.py

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

* Update pennylane/templates/state_preparations/mottonen.py

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

* Update pennylane/templates/state_preparations/mottonen.py

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

* speed up theta

* black

* Update pennylane/templates/state_preparations/mottonen.py

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

* black

* update changelog

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>

* Update jacobian_tape.py (#891)

* AngleEmbedding fewer features than qubits temp func (#881)

* Test for AngleEmbedding where there are fewer features than qubits

* Adjust

* Temp func for no shape check broadcast

* Docstring

* TODO

* format

* just limit wires

* black

* check_shape Returns in docstring

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

* Fixes bug where binary operations on PennyLane tensors results in an incorrect requires_grad attribute (#889)

* Fixes bug where binary operations on PennyLane tensors resulted in an incorrect requires_grad attribute

* linting

* linting

* more

* more

* more

* more

* final bug quashing

* remove prints

* suggested changes

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

* Support returning commuting observables on the same wire (#882)

* Prevent multiple observables on one wire

* Add test

* Add to changelog

* Update changelog

* Prevent variances as well

* Fix test

* Fix test

* Fix typo

* Update changelog

* Prevent sampling on same wire

* Add prototype version

* Add test

* Remove constant

* Integrate expand in qubit device

* Add to expand_tape

* Revert qnode changes

* Update naming

* Only expand when needed

* Remove test from qnode

* Add to test

* Correct changelog

* Update changelog

* Remove strict checks

* Add comment

* Add error

* Update tests

* Prevent expanding in qnode if using qubit device:

* Run black

* Revert qubit device

* Move functionality to qnode

* Move tests

* Update tests

* Update spacing

* Run black

* Fix tests

* Revert qubit dev

* Only expand observables if they share a wire

* Only expand observables that share a wire

* Fix tests

* Apply isort

* Fix isort

* Apply suggestions from code review

* parametrize test

* Fix CI checks:

* Actually fix CI

* Update test

* Factor out to a method

* Fix test

* Remove new line

* Minor updates

* Change variable name

* Update docstring

* Add hardware-efficient particle-conserving ansatz U1 (#875)

* Add the ParticleConservingU1 template

* Add checks to 'ParticleConservingU1' template

* Add check to 'ParticleConservingU1' template

* Import the new template and add it to the documentation

* Remove trailing space

* Fix typo in the docstring

* Add functions to generate initial parameters for the 'ParticleConservingU1' template

* Remove trailing whitespaces

* Add unit test for ParticleConservingU1 template

* Add comments in the unit test

* Polish unit test

* Complete unit test 'test_particle_conserving_u1_operations'

* Remove qchem dependency from the unit test

* Add test 'test_particle_conserving_u1_exceptions'

* Add test 'test_integration'

* Remove print line

* Add functions 'particle_conserving_u1_normal' and 'particle_conserving_u1_uniform' to INIT_KWARGS_SHAPES in 'test_init.py'

* Add unit tests for the functions 'particle_conserving_u1_uniform' and 'particle_conserving_u1_normal'

* Improve unit tests for 'particle_conserving_u1_uniform` and particle_conserving_u1_normal'

* Polish docstrings

* Add 'ParticleConservingU1' template to the integration tests

* Improve on the docstrings

* Remove trailing space

* Improve on the docstrings and update 'CHANGELOG.md'

* Polish docstrings

* Reduce size of figures in the docstring

* Reduce size of image in the docstring

* Scale image

* Add link to PL's operations page

* Polish docstring

* Apply suggestions from code review

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

* Apply suggestions from code review

* Remove 'check_type' import

* Adjust size of figure

* Adjust thumbnail image size

* Adjust aspect ratio of thumbnail figure

* Scale thumbnail

* Add new thumbnail

* Apply suggestions from code review

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

* Apply suggestions from code review

* Increase slightly the size of the figures

* Adjust size of the figures

* Apply suggestions from code review

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

* Apply suggestions from code review

* Apply suggestions from code review

* Add new function to test the decomposition of U1ex

* Polish 'test_decomposition_u1ex'

* Apply suggestions from code review

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

* Apply suggestions from code review

* Fix identation in the docstring

* Polish docstring

* Polish docstring

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>
Co-authored-by: ixfoduap <40441298+ixfoduap@users.noreply.github.com>
Co-authored-by: antalszava <antalszava@gmail.com>

* Unwrap tensor in random_layer (#893)

* Unwrap in random_layer if necessary; add test

* Docstring, default.qubit

* Test unwrapped gradient; update docstring

* Docstring

* Add qml.density_matrix QNode return with partial trace capabilities (#878)

* First implementation of density matrix for the default_qubit device

* Update with first tests.

* Black formatting.

* Correct default.qubit, add default.mixed and add tests.

* Unecessary enable tape removed

* Update pennylane/_qubit_device.py

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

* Update pennylane/_qubit_device.py

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

* Update pennylane/_qubit_device.py

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

* Update pennylane/devices/default_mixed.py

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

* Update tests/tape/test_tape_measure.py

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

* Update pennylane/devices/default_mixed.py

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

* Update tests/tape/test_tape_measure.py

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

* Update tests/tape/test_tape_measure.py

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

* Update tests/tape/test_tape_measure.py

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

* Changes from review

* Add test for all wires (density matrix)

* Better coverage

* Update changelod.md

* Update from second review.

* Blank line changelog

* Update changelog

* Update .github/CHANGELOG.md

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

* Update from third review

* Update pennylane/tape/measure.py

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

* Update pennylane/devices/default_mixed.py

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

* Update pennylane/devices/default_qubit.py

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

* Add density_matrix to tape.__init__

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: Tom Bromley <49409390+trbromley@users.noreply.github.com>

* Adding functions for agnostic tensor manipulations (#886)

* [WIP] Adding a container class for unified array manipulations

* linting

* fix docs

* add tests

* linting

* add autograd tests

* add autograd tests

* add torch tests

* add tf tests

* full coverage

* docstring

* Apply suggestions from code review

* changes

* Change to functional approach

* add more docstrings

* fix docs

* linting

* coverage

* finish tests

* Apply suggestions from code review

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

* fix typos

* Apply suggestions from code review

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

* bug fix

* Apply suggestions from code review

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

* Update pennylane/tensorbox/tensorbox.py

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

* suggested changes

* suggested changes

* change

* update changelog

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

* Add tensor unwrapping in BaseQNode for keyword arguments  (#903)

* Fix in BaseQNode

* Add staticmethod for unwrapping (codefactor); remove import

* Change to check that spots init_state difference earlier

* CHANGELOG

* Update

* Use recorder to check gates used

* Test docstrings

* Fix gradient in tape mode when measurements are independent of a parameter (#901)

* Fix batch execution for parameters that are independent of observable

* Add test

* Remove extra indent

* Fixes #709 (#899)

* Fixes #709

* Conform to PEP8

* Fixes formatting using black

* * Added a conditional test for a GPU enabled environment
* Added changelog/contribution.
* Fixed also for the tape mode

* Fixes a condition to run a CUDA related test

* Fixes a bug in test

* Update .github/CHANGELOG.md

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

* Update tests/qnn/test_qnn_torch.py

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

* Update tests/qnn/test_qnn_torch.py

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

* Update tests/qnn/test_qnn_torch.py

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

* Indentation correction

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

* Followup #899 (#906)

Fixes CUDA test

* Fixes bug in the QAOA _diagonal_terms function to take into account the queuing refactor (#905)

* Fixes bug in the QAOA _diagonal_terms function to take into account the queuing refactor

* update changelog

* Update .github/CHANGELOG.md

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

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

* Allow PennyLane to rescan and refresh available plugin devices within the same Python runtime (#907)

* Fix entrypoint colab bug

* more

* more

* final

* linting

* doc fix

* Apply suggestions from code review

* suggested changes

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

* Add decomposition for CRot gate (#908)

* Add decomposition

* Add test

* Update decomposition

* Update changelog

* Add more parameter options

* Support in non tape mode

* Update test to accommodate tape mode

* Add comment

* Add hardware-efficient particle-conserving ansatz U2 (#876)

* Add the ParticleConservingU2 template

* VQECost can optimize observables using the grouping module (#902)

* First attempt

* Add first version

* Add test

* Add to test

* Add to tests

* Run black

* Remove trailing whitespace

* Add to documentation

* Add to changelog

* Minor corrections

* Prevent calculation of the metric tensor in optimize mode

* Add test

* Apply checks

* Minor update

* Move to new feature

* Apply suggestions from code review

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

* Add mention of grouping module in changelog

* Apply suggestiosn

* Fix error in example

* Update .github/CHANGELOG.md

* Update .github/CHANGELOG.md

* Fix changelog

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

* Rename VQECost to ExpvalCost (#913)

* Rename VQECost to ExpvalCost

* Add VQECost as deprecated

* Add to changelog

* Update PR number

* Revert changes to changelog

* Change a to an

* Add pylint exception

* Remove VQECost from docs

* Reintroduce docstring

* Support returning the metric tensor of ExpvalCost in tape mode (#911)

* First attempt

* Support old qnode in tape mode

* Add test

* Switch to disabling and re-enabling tape

* Try with tests

* Make warnings appear for users

* Fix test

* Remove the _wires arg

* Remove reference to VQECost

* Add to changelog

* Rename

* Fix CI checks

* Apply suggestions from code review

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

* Add hard-coded expected val

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

* Modify qml.grad so that it stores and makes accessible the value of the intermediate forward pass (#914)

* Modify qml.grad so that it stores and makes accessible the value of the intermediate forward pass

* fix

* linting

* fix docs

* add tests

* update changelog

* Update pennylane/__init__.py

* suggested changes

* Update pennylane/__init__.py

Co-authored-by: Theodor <theodor@xanadu.ai>

Co-authored-by: Theodor <theodor@xanadu.ai>

* Remove mention of travis (#917)

* Define the generator for the MultiRZ operation (#912)

* [WIP] Define the generator for the MultiRZ operation

* Save recalculating generator

* Apply black

* Add test

* Add to changelog

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

* Support for MultiRZ and CRot in default.qubit.tf (#921)

* Adding MultiRZ default.tensor.tf func

* Add tests; docstrings; update

* String compare

* Temporarily remove CRot support so that it gets decomposed

* Formatting

* Fix

* Integration tests for parametrized gates taking a tf variable

* Update pennylane/devices/tf_ops.py

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

* Changelog

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

* Fixes bug in tape.set_parameters() (#923)

* Fixes bug in tape.set_parameters()

* add test

* re add test

* suggested changes

* Allow optimizers to return cost function output via opt step (#916)

* Modify qml.grad so that it stores and makes accessible the value of the intermediate forward pass

* fix

* linting

* fix docs

* add tests

* update changelog

* Update pennylane/__init__.py

* suggested changes

* Update pennylane/__init__.py

Co-authored-by: Theodor <theodor@xanadu.ai>

* Move grad and jacobian

* Fix optimizers

* Fix for user-defined gradients

* Run black

* Fix pylint issues

* Remove autograd functions from docs

* Apply suggestions from code review

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

* Simplify compute_gradient

* Raise error in step_and_cost for gradient-free opts

* Remove step_and_cost from rotosolve/-select

* Add simple tests

* update changelog

* Revert changes

* Add example to changelog

* Apply suggestions from code review

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

* Apply suggestions from code review

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

* Update step calculations

* Fix tests

* Add rotosolve/-select

* Apply suggestions from code review

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

* Apply suggestions from code review

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

* Update docstring

* Fix docstrings

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

* Add support for arbitrary linear combination gradient recipes (#909)

* Have positive and negative multiplier and shift values

* No print

* Formatting

* 3 element terms for grad_recipes; qubit okay; CV draft

* CV for tape mode

* Comments

* Remove unused

* Formatting

* Solve casting by specifying dtype at creation

* No casting needed for shifted

* Update module docstring and Operation.grad_recipe docstring

* Development guide update

* Wording

* Adding tests; adding error raised for unsupported logic for tape second-order CV case

* No f strings

* Update pennylane/qnodes/cv.py

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

* Update pennylane/tape/tapes/cv_param_shift.py

* Simplify using np.dot in CV param shift tape

* Update tests/qnodes/test_qnode_cv.py

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

* get_parameter_shift in tape mode as per Josh's suggestion; use that

* Changelog

* Update tests/tape/tapes/test_cv_param_shift.py

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

* Update .github/CHANGELOG.md

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

* merge in changes from 915

* Update pennylane/operation.py

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

* Update grad recipe formulae as per Tom's suggestions

* Update other formula in comment

* CHANGELOG

* Add rendering img url approach

* Plus

* Update pennylane/operation.py

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

* Applying review suggestions

* Update doc/development/plugins.rst

* Update pennylane/operation.py

* equation formatting fixes

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

* Adding controlled rotation gradients (#915)

* Have positive and negative multiplier and shift values

* No print

* Formatting

* 3 element terms for grad_recipes; qubit okay; CV draft

* CV for tape mode

* Comments

* Remove unused

* Formatting

* Solve casting by specifying dtype at creation

* No casting needed for shifted

* Update module docstring and Operation.grad_recipe docstring

* Development guide update

* Wording

* Adding tests; adding error raised for unsupported logic for tape second-order CV case

* No f strings

* adding CX gradient recipe

* Update pennylane/qnodes/cv.py

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

* Update pennylane/tape/tapes/cv_param_shift.py

* more

* more

* more tests

* fix typo

* Apply suggestions from code review

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

* Simplify using np.dot in CV param shift tape

* Update tests/qnodes/test_qnode_cv.py

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

* get_parameter_shift in tape mode as per Josh's suggestion; use that

* Changelog

* Update tests/tape/tapes/test_cv_param_shift.py

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

* Use get_parameter_shift in qubit param shift

* Specify the shift kwarg

* Further docstrings

* CHANGELOG

* Update .github/CHANGELOG.md

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

* Apply suggestions from code review

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

* merge in changes from 915

* suggested changes

* black

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

* Support multiple devices with ExpvalCost (#927)

* Fix multiple devices in ExpvalCost in tape mode

* Extend test to non-tape mode

* Fix typo

* Apply suggestions

* Applied suggestions

* Fix CI

* Update pennylane/vqe/vqe.py

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

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

* Fix incorrect exception message for unknown interfaces (#930)

* Fix incorrect exception message for unknown interfaces

* changelog

* Update qchem._terms_to_qubit_operator function to handle tensors with identities (#928)

* QChem _terms_to_qubit_operator identity cases

* Formatting

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

* Pin pyscf<1.7.4 to allow scipy>=1.5 in QChem (#926)

* Remove the pinning for scipy and add pinning for pyscf

* Update requirements.txt

* Update requirements.txt

* Update requirements.txt

* Update requirements.txt

* Pin pyscf==1.7.2

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

* Update requirements.txt

* Update changelog for the next release (#932)

* Update changelog for the next release

* Update CHANGELOG.md

* Apply suggestions from code review

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

* suggested changes

* reword tricks

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

* Improve the reliability of multi-threaded QNodeCollection execution by adding thread locking during queuing (#918)

* Fixes #910

* Added re-entrant lock guard before/after with block of QuantumTape.
* Fixes a PyTorch test failure caused by numerical precision.

* Modified the change log

* Fixes typo

* Remove dependency to template circuits from parallel test

* Added enable/disable tape mode guard for QNodeCollection test

* Added fixture param for the problematic test

* Update .github/CHANGELOG.md

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

* Update tests/tape/tapes/test_qnode.py

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

* Fixed potential deadlock because of exception in QuantumTape

* Fixed unused variable error

* Assert if QNodeCollection instantiation does not throw

* Update tests/tape/tapes/test_qnode.py

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

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

* Update docstrings (#934)

* Update readme (#933)

* Update readme

* Update readme

* Update readme

* Update readme

* Update readme

* Update readme

* Update readme

* Update readme

* Update readme

* Update readme

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* test

* test

* more

* Apply suggestions from code review

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

* Update README.md

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

* add new readme

* add new readme

* remove old readme

* Added gif

* remove file

* update gif

* crop gif

* Apply suggestions from code review

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

* revert images

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

* Bump version number to v0.13 (#935)

* Bump version number to v0.13

* Apply suggestions from code review

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

* fixes

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

* typo

* fix missing images

* Bump version number to v0.14-dev (#939)

* Bump version number to v0.14-dev

* fix

* Solving issues with black using the standard black l-100. Also, I used isort to sort the libraries.

* CI

* fix

* Apply suggestions from code review

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

* Update pennylane/devices/tests/test_compare_default_qubit.py

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

* Apply suggestions from code review

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

* Update CHANGELOG.md

Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: Maria Schuld <mariaschuld@gmail.com>
Co-authored-by: anthayes92 <34694788+anthayes92@users.noreply.github.com>
Co-authored-by: Nathan Killoran <co9olguy@users.noreply.github.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: Olivia Di Matteo <dimatteo.olivia@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: agran2018 <45397799+agran2018@users.noreply.github.com>
Co-authored-by: Christina Lee <chrissie.c.l@gmail.com>
Co-authored-by: ixfoduap <40441298+ixfoduap@users.noreply.github.com>
Co-authored-by: rmoyard <36766072+rmoyard@users.noreply.github.com>
Co-authored-by: Shumpei Kobayashi <skonb@me.com>
Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com>
Co-authored-by: Theodor <theodor@xanadu.ai>
Co-authored-by: trbromley <brotho02@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review-ready 👌 PRs which are ready for review by someone from the core team. templates 📁 Updates and additions to the templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants