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

QSP iterative angle solver #6694

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft

Conversation

cvqmm
Copy link

@cvqmm cvqmm commented Dec 10, 2024

Before submitting

Please complete the following checklist when submitting a PR:

  • All new features must include a unit test.
    If you've fixed a bug or added code that should be tested, add a test to the
    test directory!

  • All new functions and code must be clearly commented and documented.
    If you do make documentation changes, make sure that the docs build and
    render correctly by running make docs.

  • Ensure that the test suite passes, by running make test.

  • Add a new entry to the doc/releases/changelog-dev.md file, summarizing the
    change, and including a link back to the PR.

  • The PennyLane source code conforms to
    PEP8 standards.
    We check all of our code against Pylint.
    To lint modified files, simply pip install pylint, and then
    run pylint pennylane/path/to/file.py.

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


Context: QSP angle solver

Description of the Change: determine the QSP circuit angles through an iterative optimization procedure https://journals.aps.org/pra/abstract/10.1103/PhysRevA.103.042419

Benefits:

Possible Drawbacks:

Related GitHub Issues:

@cvqmm cvqmm marked this pull request as draft December 10, 2024 08:32
@cvqmm
Copy link
Author

cvqmm commented Dec 10, 2024

@KetpuntoG @AntonNI8 @DSGuala

@KetpuntoG
Copy link
Contributor

Great! Thanks for working on it :)
Let me know if you have any question

@cvqmm
Copy link
Author

cvqmm commented Dec 11, 2024

Great! Thanks for working on it :) Let me know if you have any question

thx for the support.. just a couple:

  • so you'll notice that I switched to random polynomials instead of hard coded coeffs for the tests.. the test that tests the complimentarity is falling short in terms of precision (~1e-5) instead (1e-7 which is the current atol) so idk how you/we want to resolve that (maybe reduce the atol)
  • how to integrate jit: do I give the user the command to switch to jax use or do I do it under the hood by checking whether jax is installed and if it's the case switch from autograd to jax?

@KetpuntoG
Copy link
Contributor

Great! Thanks for working on it :) Let me know if you have any question

thx for the support.. just a couple:

  • so you'll notice that I switched to random polynomials instead of hard coded coeffs for the tests.. the test that tests the complimentarity is falling short in terms of precision (~1e-5) instead (1e-7 which is the current atol) so idk how you/we want to resolve that (maybe reduce the atol)
  • how to integrate jit: do I give the user the command to switch to jax use or do I do it under the hood by checking whether jax is installed and if it's the case switch from autograd to jax?
  • Let's reduce the atol to 1-e5 for the moment 👍
  • Taking a look to the code, instead of using qml.numpy.____ you could use qml.math.___
    In that way the interface will be chosen based on the input of the function

Don't worry about jit integration. The code itself will not have jit. But it would be good to create a test to check that it will indeed work with jit. This is an example where jit is tested

@cvqmm
Copy link
Author

cvqmm commented Dec 16, 2024

Great! Thanks for working on it :) Let me know if you have any question

thx for the support.. just a couple:

  • so you'll notice that I switched to random polynomials instead of hard coded coeffs for the tests.. the test that tests the complimentarity is falling short in terms of precision (~1e-5) instead (1e-7 which is the current atol) so idk how you/we want to resolve that (maybe reduce the atol)
  • how to integrate jit: do I give the user the command to switch to jax use or do I do it under the hood by checking whether jax is installed and if it's the case switch from autograd to jax?
  • Let's reduce the atol to 1-e5 for the moment 👍
  • Taking a look to the code, instead of using qml.numpy.____ you could use qml.math.___
    In that way the interface will be chosen based on the input of the function

Don't worry about jit integration. The code itself will not have jit. But it would be good to create a test to check that it will indeed work with jit. This is an example where jit is tested

  • So I replaced qml.numpy with qml.math as suggested.. I also added a customed decorator that will jit the adequate functions if jax is available (which will also carry the test in jax if it's available).. let me know what you think..

@DSGuala
Copy link
Contributor

DSGuala commented Dec 16, 2024

🚀 Thanks for opening this PR @cvqmm !

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.

3 participants