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

Fix Evolution.generator #3796

Merged
merged 59 commits into from
Mar 23, 2023
Merged

Fix Evolution.generator #3796

merged 59 commits into from
Mar 23, 2023

Conversation

AlbertMitjans
Copy link
Contributor

@AlbertMitjans AlbertMitjans commented Feb 21, 2023

  • Generalize np.real to qml.math.real to make sure it works with all interfaces.
  • Cast coefficients to real to avoid a warning.
  • Readd features removed in Undeprecate ApproxTimeEvolution #3797

@github-actions
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@AlbertMitjans AlbertMitjans changed the title Fix generator check Fix Evolution.generator Feb 21, 2023
@codecov
Copy link

codecov bot commented Feb 21, 2023

Codecov Report

❗ No coverage uploaded for pull request base (master@ed4b440). Click here to learn what that means.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##             master    #3796   +/-   ##
=========================================
  Coverage          ?   99.73%           
=========================================
  Files             ?      344           
  Lines             ?    30154           
  Branches          ?        0           
=========================================
  Hits              ?    30075           
  Misses            ?       79           
  Partials          ?        0           
Impacted Files Coverage Δ
pennylane/ops/op_math/evolution.py 97.43% <100.00%> (ø)
pennylane/ops/op_math/exp.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Co-authored-by: Christina Lee <christina@xanadu.ai>
albi3ro and others added 6 commits February 21, 2023 15:43
* readd ApproxTimeEvolution

* More

* Full deprecation
…t` (#3651)

* Add SpecialUnitary, its utilities and tests

* changelog

* whitespace

* docstrings

* empty

* device test

* black

* linting and test coverage

* registered in default qubit and added tests

* registered in default mixed and added tests

* black

* changelog

* register with null qubit, add test, lint null qubit test as bonus

* black

* update docstring

* revert some changes/continued merge

* remove old namespace dependencies

* black

* lint

* docstring typo

* lint

* remove inverse testing

* change reference

* revert addition
@AlbertMitjans AlbertMitjans changed the base branch from master to v0.29.0-rc0 February 22, 2023 15:04
Copy link
Contributor

@rmoyard rmoyard left a comment

Choose a reason for hiding this comment

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

It looks great @AlbertMitjans 👍 Just one question and also it would be great to add a test for interfaces and coefficient

pennylane/ops/op_math/exp.py Show resolved Hide resolved
Qottmann and others added 2 commits February 22, 2023 08:50
* add ParametrizedEvolution to mixed device

* black test

* make test more broad

* black tests

* Update tests/pulse/test_parametrized_evolution.py

Co-authored-by: David Wierichs <david.wierichs@xanadu.ai>

* sparse implementation

* Revert "Merge branch 'evolvemixed' of https://github.com/PennyLaneAI/pennylane into evolvemixed"

This reverts commit e653b50, reversing
changes made to bb2d3d6.

* Revert "sparse implementation"

This reverts commit bb2d3d6.

* review comment

* trigger ci

---------

Co-authored-by: David Wierichs <david.wierichs@xanadu.ai>
pennylane/_version.py Outdated Show resolved Hide resolved
pennylane/pulse/__init__.py Outdated Show resolved Hide resolved
@rmoyard rmoyard self-requested a review March 1, 2023 22:34
@rmoyard rmoyard removed this from the Release v0.29 milestone Mar 1, 2023
@rmoyard
Copy link
Contributor

rmoyard commented Mar 2, 2023

    @property
    def grad_method(self):
        return self.base.grad_method if hasattr(self.base, "grad_method") else super().grad_method

Is it needed in this PR @albi3ro ?

Copy link
Contributor

@rmoyard rmoyard left a comment

Choose a reason for hiding this comment

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

Thanks @AlbertMitjans 💯

@timmysilv
Copy link
Contributor

I'm not sure what prompted this PR, can someone give an example of what causes this warning? if it's because the user provided something that might result in something that requires truncating some produced real part of a coefficient, idk if hiding a warning is the best move. If it's just because of weird typing things and a result of pennylane implementation details, this lgtm 👍

@rmoyard
Copy link
Contributor

rmoyard commented Mar 21, 2023

@timmysilv We were using plain numpy to do operations (real) on array boxes which are autograd objects. We need to make that more general and use the math module.

@rmoyard rmoyard requested a review from timmysilv March 21, 2023 17:23
@rmoyard rmoyard enabled auto-merge (squash) March 21, 2023 17:45
Copy link
Contributor

@timmysilv timmysilv left a comment

Choose a reason for hiding this comment

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

still not 100% sure what warning we're avoiding. i'm guessing it's a teeny tiny real part sneaking into the coeff and we're just filtering it out, which is good for me. either way it looks good

@rmoyard rmoyard merged commit e6f92ef into master Mar 23, 2023
@rmoyard rmoyard deleted the fix-evolution branch March 23, 2023 20:53
mudit2812 added a commit that referenced this pull request Apr 13, 2023
* 🐛 fix (Evolution): Fix generator.

* 🐛 fix (Evolution): Cast values to real.

* 🐛 fix (Evolution): Cast values to real.

* 🐛 fix (Exp): Use qml.math.

* 🐛 fix (Exp): Use qml.math.

* ⏪ revert (Exp)

* 🐛 fix (Exp): Set has_matrix to False when using autograd. Remove Exp and Evolution from DefaultQubit.

* Update pennylane/ops/op_math/exp.py

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

* Update pennylane/ops/op_math/exp.py

* changelog

* Undeprecate `ApproxTimeEvolution` (#3797)

* readd ApproxTimeEvolution

* More

* Full deprecation

* Fix (#3801)

* Register `SpecialUnitary` operation with `DefaultMixed` and `NullQubit` (#3651)

* Add SpecialUnitary, its utilities and tests

* changelog

* whitespace

* docstrings

* empty

* device test

* black

* linting and test coverage

* registered in default qubit and added tests

* registered in default mixed and added tests

* black

* changelog

* register with null qubit, add test, lint null qubit test as bonus

* black

* update docstring

* revert some changes/continued merge

* remove old namespace dependencies

* black

* lint

* docstring typo

* lint

* remove inverse testing

* change reference

* revert addition

* ⏪ revert (Exp): Add Exp back to QubitDevice.observables.

* ⏪ revert (master): Revert unwanted changes from master branch.

* ⏪ revert (Evolution): Re-add removed code from Evolution.

* ✏️ chore (changelog): Change changelog entry.

* add ParametrizedEvolution to mixed device (#3794)

* add ParametrizedEvolution to mixed device

* black test

* make test more broad

* black tests

* Update tests/pulse/test_parametrized_evolution.py

Co-authored-by: David Wierichs <david.wierichs@xanadu.ai>

* sparse implementation

* Revert "Merge branch 'evolvemixed' of https://github.com/PennyLaneAI/pennylane into evolvemixed"

This reverts commit e653b50, reversing
changes made to bb2d3d6.

* Revert "sparse implementation"

This reverts commit bb2d3d6.

* review comment

* trigger ci

---------

Co-authored-by: David Wierichs <david.wierichs@xanadu.ai>

* little touchups while reviewing changes in 0.29 (#3809)

* Update pulse module documentation examples (#3805)

* init

* spacing

* windows parsing in rect()

* revert jnp.array parameters, doc typo

* test docstring, remove interface warning

* doc fix?

* lint

---------

Co-authored-by: lillian542 <38584660+lillian542@users.noreply.github.com>

* Raise error when using `qml.probs` in the computational basis with non-commuting observables (#3811)

* 🐛 fix (MeasurementProcess): Change if a measurement is using the computational basis.

* 🎨 style (MeasurementProcess): Remove useless properties.

* 🧪 tests (qscript): Fix tests.

* 🧪 tests (measurements): Fix tests.

* 🧪 tests (return_types): Fix tests.

* 🧪 tests (tape): Fix tests.

* 🧪 tests (circuit_graph): Fix tests.

* 🧪 tests (return_types): Fix tests.

* 🧪 tests (return_types): Fix tests.

* ✏️ chore (changelog): Add changelog entry.

* 🔧 refactor (MeasurementProcess): Change method name.

* 🔧 refactor (MeasurementProcess): Change method name.

* 🔧 refactor (MeasurementProcess): Change method name.

* Update pennylane/tape/qscript.py

Co-authored-by: Romain Moyard <rmoyard@gmail.com>

---------

Co-authored-by: Romain Moyard <rmoyard@gmail.com>

* docs: consistent naming of tape instance in docstr (#3795)

as title states. nothing fancy here

* Documentation fixes (#3808)

* fix some type hints

* minor docstring fixes

* minor docstring changes

* fix rendering issue

* Update pennylane/pulse/parametrized_hamiltonian.py

---------

Co-authored-by: Matthew Silverman <matthews@xanadu.ai>

* Fix docs of new features (#3818)

* ✏️ chore (changelog): Fix changelog entry.

* 📝 docs (BasisRotation): Fix docstrings.

* 📝 docs (xyx_decompositions): Fix docstring.

* 📝 docs (metric_tensor): Fix docstring.

* Minor fixes for v0.29 release (#3815)

* Added fixes for auto documentation

* Added minor doc changes for hadamard gradient

* Added fix for queuing diagonalizing gates

* Small fix to IsingZZ doc

* Fixed doc for max_entropy

---------

Co-authored-by: Albert Mitjans <a.mitjanscoma@gmail.com>

* Copy one-electron integrals inside `_chemist_transform` (#3816)

* fix inplace one-int issue in `_chemist_transform`

* add test to assert no inplace manipulation happens

* happy black

* Fix equal for measurements with observables, measurement process repr, Hermitian casting fix (#3820)

* equal with measurement processes

* not change math.asarray for autograd

* not change math.asarray for autograd

* Update doc/releases/changelog-0.29.0.md

* add coverage for measurements of observables that are equal but have different wire orders

* break up docstrings, test hermitian case

* Update exp.py

fixing docs typo in RC branch

* Docstring fixes for unchanged functions (#3824)

* Added docstring fixes for old functions

* Updated more docs

* Changing functions

* Fixed more docstrings

* Added changes to more function docs

* Fix to build sphinx

* Addressing PR comments

* fix docker link; remove old inv comment (#3823)

* Device api doc typo fixes (#3819)

* tiny doc edits

* Update pennylane/devices/experimental/device_api.py

Co-authored-by: Matthew Silverman <matthews@xanadu.ai>

* seealso

* Update pennylane/devices/experimental/device_api.py

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

---------

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

* un-deprecate make_tape (#3807)

* Update changelog (#3719)

* Update changelog-dev.md

* Remove

* Move pulse

* Update title

* pulse edits

* minor

* Absorb new additions

* Reorder improvements

* Add new section

* Add commas to contributors section

* Remove order requirement

* Rearrange

* Simplify pulse section

* Improve

* Improve

* Improve

* Improve

* Add additional section

* Update doc/releases/changelog-dev.md

* brackets around PR numbers

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

* Apply suggestions from code review

Co-authored-by: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com>

* Add suggestions

Co-authored-by: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com>

* Update doc/releases/changelog-dev.md

* qml.

* removed TODO markers

* deps and breaking changes

* deps and breaking changes

* Move addtion

* Apply suggestions from code review

* Update

* Update

* Update

* Update

* Update

* Update

* Apply suggestions from code review

* Update

* Update

* Update

* Update

* Add for Evolve

* Add

* Apply suggestions from code review

Co-authored-by: Korbinian Kottmann <43949391+Qottmann@users.noreply.github.com>

* Fix code

* minor

* minor

* minor

* minor

* minor

* minor

* minor

* minor

* minor

* minor

* Tom

* Add entry

* Update name

* Update

* Rearrange for auto

* Typo

* Remove ApproxTimeEvolution deprecation

* Typo

* minor

* minor

* Fix warning

* Maybe fix warning

* Add a few entries

* Add breaking change

* Maybe fix error

* Maybe fix warning

* minor

* minor

* add details to changelog for marginal_prob bug (#3821)

* Add subsection

* Update

* Update

* Add

---------

Co-authored-by: Isaac De Vlugt <isaacdevlugt@gmail.com>
Co-authored-by: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com>
Co-authored-by: Korbinian Kottmann <43949391+Qottmann@users.noreply.github.com>
Co-authored-by: Matthew Silverman <matthews@xanadu.ai>

* Fix sign expand (#3814)

* Tape queue to script

* Fix doc

* QNode example

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Matthew Silverman <matthews@xanadu.ai>

* use new pauli module

---------

Co-authored-by: Matthew Silverman <matthews@xanadu.ai>
Co-authored-by: Albert Mitjans <a.mitjanscoma@gmail.com>

* Fix (#3828)

* Remove warning. (#3829)

* Update deprecations page (#3830)

* Update grouping

* Update seed recipes

* Update QubitDevice.statistics

* Raise error if JAX or jaxlib are 0.4.4 (#3813)

* Raise error for 0.4.4 jaxlib and jax

* add tests

* black for tests

* add jax mark for test

* Remove jaxlib check

Co-authored-by: Filippo Vicentini <filippovicentini@gmail.com>

* More detailed error msg

Co-authored-by: Filippo Vicentini <filippovicentini@gmail.com>

* Update tests

* Tests and black

* Typo

* Change

---------

Co-authored-by: Filippo Vicentini <filippovicentini@gmail.com>
Co-authored-by: Romain Moyard <rmoyard@gmail.com>

* 0.29 changelog updates (#3835)

* Update codeblock type

* Update example

* Wording

* Add CTA

* Update wire number

* Remove wire

* Update wording

* Add

* Fix imports

* Add deprecation

* Remove tilde

* Merge data and other improvements

* Typo

* Typo

* Typo

* Emojis

* Remove whitespace

* remove duplicate entries

* Apply suggestions from code review

Co-authored-by: Matthew Silverman <matthews@xanadu.ai>

---------

Co-authored-by: Matthew Silverman <matthews@xanadu.ai>

* Docfix/circuits note gpu (#3836)

* Fix note on lightning.gpu plugin in intro/circuits.

* Update doc/releases/changelog-0.29.0.md.

---------

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

* Promote warning about vanilla version of NumPy to RST warning. (#3838)

* Promote warning about vanilla version of NumPy from bold format to RST warning. Make Autograd case uniform.

* Update changlog.

* fix strings that wrap around without a space (#3837)

* fix strings that wrap around without a space

* missed one

* always use trailing whitespace instead of leading

---------

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

* Use default.qubit.jax instead of default.qubit (#3839)

* Use default.qubit.jax instead of default.qubit

* Apply suggestions from code review

Taking the liberty to commit these changes here due to time sensitivity

* Revert "Apply suggestions from code review
"

This reverts commit d457ffb.

---------

Co-authored-by: Korbinian Kottmann <43949391+Qottmann@users.noreply.github.com>
Co-authored-by: Korbinian Kottmann <Korbinian.Kottmann@gmail.com>

* Update header images (#3827)

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

* Doc update

* Update master

* Update pennylane/_version.py

* Apply suggestions from code review

* Readd repr

* Replace np by math

---------

Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: albi3ro <chrissie.c.l@gmail.com>
Co-authored-by: Romain Moyard <rmoyard@gmail.com>
Co-authored-by: David Wierichs <david.wierichs@xanadu.ai>
Co-authored-by: Korbinian Kottmann <43949391+Qottmann@users.noreply.github.com>
Co-authored-by: Matthew Silverman <matthews@xanadu.ai>
Co-authored-by: lillian542 <38584660+lillian542@users.noreply.github.com>
Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
Co-authored-by: Utkarsh <utkarshazad98@gmail.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: Isaac De Vlugt <isaacdevlugt@gmail.com>
Co-authored-by: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com>
Co-authored-by: Filippo Vicentini <filippovicentini@gmail.com>
Co-authored-by: Vincent Michaud-Rioux <vincentm@nanoacademic.com>
Co-authored-by: Korbinian Kottmann <Korbinian.Kottmann@gmail.com>
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.