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

Allow postselecting on mid-circuit measurement results #4442

Closed
wants to merge 179 commits into from

Conversation

mudit2812
Copy link
Contributor

Context:

Description of the Change:

Benefits:

Possible Drawbacks:

Related GitHub Issues:

mudit2812 and others added 30 commits July 27, 2023 16:59
* Add vjp/jvp capabilities

* pylint

* some tests for simulate

* Fix syntax error

* Split simulate

* Add some tests

* pylint

* more device tests

* pylint and fix tests

* change tracker keys

* Update pennylane/devices/qubit/adjoint_jacobian.py

Co-authored-by: Christina Lee <[email protected]>

* other places

* Add docs for simulate funcs

* revert suggestion

* Remove validation

* Add validation for use_device_gradient

* remove None case

* use device gradient in validation

* changelog

---------

Co-authored-by: Christina Lee <[email protected]>
…ded (#4394)

* initialize dev rng from global state

* change default value to global str

* Apply suggestions from code review

Co-authored-by: Frederik Wilde <[email protected]>

* Update tests/devices/experimental/test_default_qubit_2.py

* fix indentation

---------

Co-authored-by: Frederik Wilde <[email protected]>
* Testing changes to operator __eq__

* Updated until `nodes_between`

* Updated metric tensor, circuit graph

* Updating `qml.equal`

* Linters

* Updated tape tests

* Added coverage

* Updates changelog

* Removed changes to __eq__ and __hash__

* Update pennylane/operation.py

Co-authored-by: Matthew Silverman <[email protected]>

* Update pennylane/ops/functions/equal.py

Co-authored-by: Christina Lee <[email protected]>

---------

Co-authored-by: Matthew Silverman <[email protected]>
Co-authored-by: Christina Lee <[email protected]>
* Fixes for new autoray version

* unused import

* Use if instead of try-except

* Fix case of two torch tensors

* pin autoray

* dispatch

* test with new version
…aviour (#4144)

* Updated Operator

* Added tests

* Updated warning

* black

* Updated warning text

* black

* Update doc/development/deprecations.rst

* Updated docs, tests

* Updated deprecations.rst

* Fixing tests

* Updated tests and warnings

* Pylint

* Testing warnings

* Testing changes

* Updated tests

* testing what breaks

* Checking tests

* Testing changes

* Testing changes to operator __eq__

* Updated until `nodes_between`

* Updated metric tensor, circuit graph

* Updating `qml.equal`

* Linters

* Updated tape tests

* Added coverage

* Updates changelog

* Removed changes to __eq__ and __hash__

* Update pennylane/operation.py

Co-authored-by: Matthew Silverman <[email protected]>

* Testing changes to operator __eq__

* Updated until `nodes_between`

* Updated metric tensor, circuit graph

* Updating `qml.equal`

* Linters

* Fixes for new autoray version (#4396)

* Fixes for new autoray version

* unused import

* Use if instead of try-except

* Fix case of two torch tensors

* Updated tape tests

* Add ability to apply `TransformProgram` to batch of tapes (#4364)

* Draft structure

* draf exec

* Simple execute

* Update

* More tests

* Update

* Update exec

* Pylint and black

* Update tests

* Update more tests

* More tests

* changelog

* Coverage

* Cover fix

* pylint

* Pylint

* Pylint tests

* proposed changes to transform program integration

* oops

* add to legacy, remove cotransform support

* just transform program call component

* just transform program call component

* no longer support cotransforms, fix _batch_postprocessing

* some more testing

* test null postprocessing function

* docstring, rename batch_slices to slices, black

* Apply suggestions from code review

Co-authored-by: Matthew Silverman <[email protected]>

---------

Co-authored-by: rmoyard <[email protected]>
Co-authored-by: Matthew Silverman <[email protected]>

* torch qnode integration with DefaultQubit2 (#4392)

* copy-paste torch file; replace device in most places

* make tests work; little changes in pennylane

* pylint fix

* changelog

* update test name and docstring for hamiltonian_expand

* minimal test for single-shot bugfix

* Added coverage

* Updates changelog

* Removed changes to __eq__ and __hash__

* Update pennylane/operation.py

Co-authored-by: Matthew Silverman <[email protected]>

* Updated deprecations to 0.32

* Added warnings

* Trigger CI

* Removed docstrings

* Added correctness test

* Trigger CI

---------

Co-authored-by: Tom Bromley <[email protected]>
Co-authored-by: Matthew Silverman <[email protected]>
Co-authored-by: Edward Jiang <[email protected]>
Co-authored-by: Christina Lee <[email protected]>
Co-authored-by: rmoyard <[email protected]>
* copy-paste tf files

* make tests work; little changes in pennylane

* changes coming from torch PR first

* update remaining test files

* support tf.function by adding empty kwargs

* update copyright year in test files

* changelog

* put all qnode integrations together
* Fix jax.ad deprecation.

* Update changelog.

* Print name of requested device in DeviceError.

* Force push.

* Fix pytest.raises in test_device.py
* fix has_decomposition for ControlledQubitUnitary

* changelog

* add comment; add test when super returns False
* `wire_order` kwarg for `Tensor.sparse_matrix()`

* update changelog

* swap kwarg order

Co-authored-by: Matthew Silverman <[email protected]>

* adapt docstring to the kwarg order swap

* add comment about using  over

---------

Co-authored-by: Matthew Silverman <[email protected]>
…4388)

* default shots on new device interface

* make fewer changes and clean stuff up later

* fix tests, lint, and sphinx

* Update doc/releases/changelog-dev.md

* Update tests/interfaces/test_set_shots.py

Co-authored-by: Matthew Silverman <[email protected]>

* Update tests/devices/experimental/test_default_qubit_2.py

* make set_shots error with new device, shots type hinting

* Update doc/releases/changelog-dev.md

Co-authored-by: Tom Bromley <[email protected]>

* Update pennylane/interfaces/set_shots.py

Co-authored-by: Matthew Silverman <[email protected]>

* Apply suggestions from code review

* Update tests/devices/experimental/test_default_qubit_2.py

* merge problem

* black

* Update doc/releases/changelog-dev.md

* Update pennylane/qnode.py

Co-authored-by: Edward Jiang <[email protected]>

---------

Co-authored-by: Matthew Silverman <[email protected]>
Co-authored-by: Tom Bromley <[email protected]>
Co-authored-by: Edward Jiang <[email protected]>
mudit2812 and others added 26 commits August 10, 2023 10:06
* Support midcircuit stateprep

* Added tests for code cobv

* changelog

* lint

* fix typo

* fix doc-string

* address code review

* lint

* ci

* Support `StatePrep` mid-circuit for `DefaultQubit2` (#4444)

* Add support for defaultqubit2

* changelog

* lint

* ci

* code review

* Update doc/releases/changelog-dev.md

Co-authored-by: Christina Lee <[email protected]>

---------

Co-authored-by: Christina Lee <[email protected]>
* Allow shots reuse

* various fixes

* remove block comment

* Add test for multiple shadow measurements

* add test for shots reuse

* Apply suggestions from code review

Co-authored-by: Mudit Pandey <[email protected]>

* Update pennylane/devices/qubit/sampling.py

* split variable

* simplification

* fix

* Update pennylane/devices/qubit/sampling.py

Co-authored-by: Christina Lee <[email protected]>

* Address PR comments

* pylint

---------

Co-authored-by: Mudit Pandey <[email protected]>
Co-authored-by: Christina Lee <[email protected]>
* bugfix: substraction works with new opmath

* changelog

* add test when not implemented

* use s_prod in Operator.__sub__
Base automatically changed from qubit-reuse to master August 15, 2023 23:54
@mudit2812
Copy link
Contributor Author

Postselection being implemented in #4604 . Closing this.

@mudit2812 mudit2812 closed this Oct 19, 2023
@trbromley trbromley deleted the mcm-postselect branch March 7, 2024 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.