-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Numerical Integration methods for real and imaginary time evolution. #8399
Conversation
This reverts commit 871f29e.
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the the following people are requested to review this:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left first part of feedback. Perhaps we could introduce an abstract parent class to reduce code duplication.
qiskit/algorithms/evolvers/classical_methods/scipy_imaginary_evolver.py
Outdated
Show resolved
Hide resolved
qiskit/algorithms/evolvers/classical_methods/scipy_imaginary_evolver.py
Outdated
Show resolved
Hide resolved
qiskit/algorithms/evolvers/classical_methods/scipy_imaginary_evolver.py
Outdated
Show resolved
Hide resolved
qiskit/algorithms/evolvers/classical_methods/scipy_imaginary_evolver.py
Outdated
Show resolved
Hide resolved
qiskit/algorithms/evolvers/classical_methods/scipy_imaginary_evolver.py
Outdated
Show resolved
Hide resolved
qiskit/algorithms/evolvers/classical_methods/scipy_imaginary_evolver.py
Outdated
Show resolved
Hide resolved
qiskit/algorithms/evolvers/classical_methods/scipy_imaginary_evolver.py
Outdated
Show resolved
Hide resolved
qiskit/algorithms/evolvers/classical_methods/scipy_real_evolver.py
Outdated
Show resolved
Hide resolved
qiskit/algorithms/evolvers/classical_methods/scipy_real_evolver.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments (mainly about docs and the tests) I only left for the imaginary classes but they do also apply for the real classes 🙂
qiskit/algorithms/evolvers/classical_methods/scipy_imaginary_evolver.py
Outdated
Show resolved
Hide resolved
qiskit/algorithms/evolvers/classical_methods/scipy_imaginary_evolver.py
Outdated
Show resolved
Hide resolved
qiskit/algorithms/evolvers/classical_methods/scipy_imaginary_evolver.py
Outdated
Show resolved
Hide resolved
qiskit/algorithms/evolvers/classical_methods/scipy_imaginary_evolver.py
Outdated
Show resolved
Hide resolved
qiskit/algorithms/evolvers/classical_methods/scipy_imaginary_evolver.py
Outdated
Show resolved
Hide resolved
test/python/algorithms/evolvers/classical_methods/test_scipy_imaginary_evolver.py
Outdated
Show resolved
Hide resolved
test/python/algorithms/evolvers/classical_methods/test_scipy_imaginary_evolver.py
Outdated
Show resolved
Hide resolved
test/python/algorithms/evolvers/classical_methods/test_scipy_imaginary_evolver.py
Outdated
Show resolved
Hide resolved
test/python/algorithms/evolvers/classical_methods/test_scipy_imaginary_evolver.py
Outdated
Show resolved
Hide resolved
test/python/algorithms/evolvers/classical_methods/test_scipy_real_evolver.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the good work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments, the main one is on the naming of the timesteps 🙂
qiskit/algorithms/time_evolvers/classical_methods/scipy_imaginary_evolver.py
Outdated
Show resolved
Hide resolved
qiskit/algorithms/time_evolvers/classical_methods/scipy_imaginary_evolver.py
Outdated
Show resolved
Hide resolved
qiskit/algorithms/time_evolvers/classical_methods/scipy_real_evolver.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Julien Gacon <gaconju@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks for this great feature!
@Mergifyio requeue |
✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically |
…iskit#8399) * All Changes so far * Revert "All Changes so far" This reverts commit 871f29e. * Quantum Time Evolution * operators and frob norm * fro norm * Changes * changes * Added history * Removed files and fixed lint * Changed name * fixed accuracy associated to bicg * Changed imaginary * Fixed output for observables * version * changes * Comments Part 1 * make black * Changed output observalbes * Changed to taylor expansion * black * Documentation * black * Some comments * redesign * changes * restore evolvers * unittest redoing path * make black * Fixed docs? * Fixed issue with scipy1.7.3 * Delete 1.8 * Review * Deleted opflow * times documentation T_ev_result * Added example to reno * Julien review * Update releasenotes/notes/scipy-evolvers-ca92bcb90e90b035.yaml * Update releasenotes/notes/scipy-evolvers-ca92bcb90e90b035.yaml Co-authored-by: Julien Gacon <gaconju@gmail.com> * observable in reno Co-authored-by: Julien Gacon <gaconju@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…iskit#8399) * All Changes so far * Revert "All Changes so far" This reverts commit 871f29e. * Quantum Time Evolution * operators and frob norm * fro norm * Changes * changes * Added history * Removed files and fixed lint * Changed name * fixed accuracy associated to bicg * Changed imaginary * Fixed output for observables * version * changes * Comments Part 1 * make black * Changed output observalbes * Changed to taylor expansion * black * Documentation * black * Some comments * redesign * changes * restore evolvers * unittest redoing path * make black * Fixed docs? * Fixed issue with scipy1.7.3 * Delete 1.8 * Review * Deleted opflow * times documentation T_ev_result * Added example to reno * Julien review * Update releasenotes/notes/scipy-evolvers-ca92bcb90e90b035.yaml * Update releasenotes/notes/scipy-evolvers-ca92bcb90e90b035.yaml Co-authored-by: Julien Gacon <gaconju@gmail.com> * observable in reno Co-authored-by: Julien Gacon <gaconju@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…iskit/qiskit#8399) * All Changes so far * Revert "All Changes so far" This reverts commit 871f29ef540d3d5f93e3ffb5bee17295b3d4d65c. * Quantum Time Evolution * operators and frob norm * fro norm * Changes * changes * Added history * Removed files and fixed lint * Changed name * fixed accuracy associated to bicg * Changed imaginary * Fixed output for observables * version * changes * Comments Part 1 * make black * Changed output observalbes * Changed to taylor expansion * black * Documentation * black * Some comments * redesign * changes * restore evolvers * unittest redoing path * make black * Fixed docs? * Fixed issue with scipy1.7.3 * Delete 1.8 * Review * Deleted opflow * times documentation T_ev_result * Added example to reno * Julien review * Update releasenotes/notes/scipy-evolvers-ca92bcb90e90b035.yaml * Update releasenotes/notes/scipy-evolvers-ca92bcb90e90b035.yaml Co-authored-by: Julien Gacon <gaconju@gmail.com> * observable in reno Co-authored-by: Julien Gacon <gaconju@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This addresses #8342.
The goal of this PR is to implement 2 classes that inherit from RealEvolver and ImaginaryEvolver and solve the time evolution of a state using classical methods.
Both classes will be very similar, but the RealEvolver will use a biconjugate gradient descent method to make each step (this allows the step evolution operator to be unitary) and for the ImaginaryEvolver a taylor expansion of the time evolution operator will be used at each timestep (and the state renormalized).
The user can specify a list, or dictionary, of observables and their expectancy value will be computed at each timestep and returned as a list or a dictionary respectively.
Lastly, there is a method that allows to estimate the number of timesteps needed to reach a certain error threshold given the norm of the hamiltonian to evolve under. I am not completely sure if this feature is over complicating the interface unnecessarily, so let me know what you think about it. Basically it consists on taking the next taylor expansion term and using it to compute the minimum ammount of timesteps necessary to yield a given error.