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

Trotterization-based Quantum Real Time Evolution #7411

Merged
merged 176 commits into from
Apr 27, 2022

Conversation

dlasecki
Copy link
Contributor

@dlasecki dlasecki commented Dec 14, 2021

Summary

This PR introduces the Trotterization-based Quantum Real Time Evolution algorithm.

  • It is compliant with the new Quantum Time Evolution Framework.
  • It makes use of recent ProductFormula and PauliEvolutionGate implementations.
  • It is meant to replace current Trotterization implementation in Qiskit Terra. It provides the same functionalities.

It closes the following epic:

Details and comments

There are still some minor TODOs indicated in the code:

  • Add unit tests for some private helper functions.
  • Address a problem that causes probabilistic results in one unit test. (it seems to be originating from the custom observable and the order in which it is calculated).
  • Extend input validation to cover types: PauliOp and OperatorBase and their dependence on parameters.
  • Add docs for the package.
  • Add a release note.

The replacement of current Trotter algorithms (in places where they are used) by this algorithm will happen in a separate PR.

To allow time-dependent Hamiltonians supported in this PR, there will be a separate PR prepared. Currently, an error message is thrown in case of time-dependent Hamiltonians.

dlasecki and others added 2 commits April 26, 2022 17:13
Co-authored-by: Julien Gacon <gaconju@gmail.com>
@Cryoris Cryoris added the Changelog: New Feature Include in the "Added" section of the changelog label Apr 26, 2022
Copy link
Contributor

@Cryoris Cryoris left a comment

Choose a reason for hiding this comment

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

In the initializer we can currently set the attributes to None but the getters and setters typehints indicate that a value is always returned. Could we make the getters and setters consistent and indicate that also None can be returned? Probably the getter typehints should then also support None 🙂

qiskit/algorithms/evolvers/trotterization/trotter_qrte.py Outdated Show resolved Hide resolved
qiskit/algorithms/evolvers/trotterization/trotter_qrte.py Outdated Show resolved Hide resolved
qiskit/algorithms/evolvers/trotterization/trotter_qrte.py Outdated Show resolved Hide resolved
qiskit/algorithms/evolvers/trotterization/trotter_qrte.py Outdated Show resolved Hide resolved
qiskit/algorithms/evolvers/trotterization/trotter_qrte.py Outdated Show resolved Hide resolved
qiskit/algorithms/evolvers/trotterization/trotter_qrte.py Outdated Show resolved Hide resolved
qiskit/algorithms/evolvers/trotterization/trotter_qrte.py Outdated Show resolved Hide resolved
dlasecki and others added 8 commits April 26, 2022 23:26
Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
@mergify mergify bot merged commit 18b5a04 into Qiskit:main Apr 27, 2022
ElePT pushed a commit to ElePT/qiskit that referenced this pull request Jun 27, 2023
* Introduced time evolution classes and interfaces.

* Migrated trotterization as trotterization builder.

* Implemented enum for trotterization mode; fixed imports.

* Implemented trotter_qrte.py with unit tests.

* trotter_qrte.py repetitions added.

* Code refactoring.

* Code refactoring.

* Gradient object introduced in a signature.

* Draft of trotter_qrte.py gradient with unit tests.

* trotter_qrte.py improvements; unit tests extended.

* trotter_qrte.py improvements; unit tests extended.

* Trotter test fix.

* Fixed float and complex handling.

* qrte with product formula

* Removed irrelevant files.

* Removed irrelevant files.

* Extended docs.

* Removed outdated unit tests.

* Removed outdated files.

* Code refactoring, docs extended.

* Code refactoring.

* Updated unit tests.

* Code refactoring, extended docs and typehints.

* Reno added.

* Extended checks and unit tests.

* Code refactoring.

* Code refactoring.

* fix problem with test

* Docs extended.

* Added support for PauliOp, code refactoring.

* Implemented general Quantum Time Evolution Framework interfaces.

* Updated docs.

* Reno added.

* Improved reno.

* Code refactoring.

* Update qiskit/algorithms/time_evolution/evolution_base.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Code refactoring.

* Introduced evolution problem classes.

* Code refactoring.

* Apply suggestions from code review

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Added unit tests.

* Lint fixed.

* Code refactoring

* Code refactoring

* Code refactoring

* Code refactoring

* Code refactoring

* Code refactoring

* Code review changes.

* Removed gradient code for now.

* Code review refactoring.

* Removed gradient code for now.

* Evolving observable removed. Evaluating observables added.

* Code refactoring.

* Improved naming.

* Improved folder structure; filled evolvers init file.

* Added Evolvers to algorithms init file.

* Fixed missing imports.

* Code refactoring

* Fixed cyclic imports.

* Extracted ListOrDict.

* Code refactoring.

* Code refactoring.

* Fixed release note.

* Fixed inheritance order.

* Updated code to the latest time evolution interface.

* Code refactoring.

* Code refactoring.

* Code refactoring.

* Fixed cyclic imports.

* Fixed pylint.

* Name fix.

* Import fix.

* Lint fix.

* Lint fix.

* Code refactoring.

* Extracted and refactored aux_ops_evaluator.py

* Code refactoring

* Implemented unit test.

* Extended unit test.

* Date fixed.

* Reno added.

* Switched to bound ansatz.

* Fix reno.

* Added docs.

* Refactored unit test.

* Lint fixed.

* Code review edits.

* Added unit test cases for dicts.

* Fixed reno reference.

* Improved unit test.

* Added quantum instance support.

* Added support for aux_ops and unit test.

* Fixed input object to eval_observables.

* Fixed quantum_state types and conversion.

* Fixed quantum_state types and conversion.

* Fixed types and docs.

* Code refactoring.

* Lint fix.

* Code refactoring.

* Reno update.

* Code refactoring.

* Implemented some CR feedback.

* evolution_problem.py fix

* Removed trotter_ops_validator.py for now, extended unit tests, code refactoring.

* Updated names of the algorithm.

* Added support for QuantumCircuit input. Code refactoring.

* Improved error handling in evolution_problem.py and unit tests added.

* Code refactoring.

* Cyclic import fix

* Refactored evolution_problem.py

* Refactored test_trotter_qrte.py

* Removed global tolerance.

* CI fix.

* Code review fixes.

* Code refactoring.

* Prepared qasm unit test.

* Removing state eval.

* Refactored and updated tests.

* Added qasm test for aux ops.

* Added param binding test.

* Added missing setters.

* Updated unit tests.

* Improved folder structure.

* Updated interfaces.

* Fix lint.

* Removed legacy (soon) BaseBackend.

* Updated copyright years.

* Added example to reno.

* Fixed reno.

* Removed BaseOperator.

* Code refactoring.

* Imports fix.

* Delayed parameters checks.

* Update qiskit/algorithms/evolvers/evolution_problem.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Code refactoring.

* Update qiskit/algorithms/evolvers/evolution_problem.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Update qiskit/algorithms/evolvers/trotterization/trotter_qrte.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Update qiskit/algorithms/evolvers/trotterization/trotter_qrte.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Update qiskit/algorithms/evolvers/trotterization/trotter_qrte.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Update qiskit/algorithms/evolvers/trotterization/trotter_qrte.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Update qiskit/algorithms/evolvers/trotterization/trotter_qrte.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Update qiskit/algorithms/evolvers/trotterization/trotter_qrte.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Update qiskit/algorithms/evolvers/trotterization/trotter_qrte.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Expectation might be None

Co-authored-by: acv@zurich.ibm.com <acv@zurich.ibm.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
ElePT pushed a commit to ElePT/qiskit-algorithms-test that referenced this pull request Jul 17, 2023
* Introduced time evolution classes and interfaces.

* Migrated trotterization as trotterization builder.

* Implemented enum for trotterization mode; fixed imports.

* Implemented trotter_qrte.py with unit tests.

* trotter_qrte.py repetitions added.

* Code refactoring.

* Code refactoring.

* Gradient object introduced in a signature.

* Draft of trotter_qrte.py gradient with unit tests.

* trotter_qrte.py improvements; unit tests extended.

* trotter_qrte.py improvements; unit tests extended.

* Trotter test fix.

* Fixed float and complex handling.

* qrte with product formula

* Removed irrelevant files.

* Removed irrelevant files.

* Extended docs.

* Removed outdated unit tests.

* Removed outdated files.

* Code refactoring, docs extended.

* Code refactoring.

* Updated unit tests.

* Code refactoring, extended docs and typehints.

* Reno added.

* Extended checks and unit tests.

* Code refactoring.

* Code refactoring.

* fix problem with test

* Docs extended.

* Added support for PauliOp, code refactoring.

* Implemented general Quantum Time Evolution Framework interfaces.

* Updated docs.

* Reno added.

* Improved reno.

* Code refactoring.

* Update qiskit/algorithms/time_evolution/evolution_base.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Code refactoring.

* Introduced evolution problem classes.

* Code refactoring.

* Apply suggestions from code review

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Added unit tests.

* Lint fixed.

* Code refactoring

* Code refactoring

* Code refactoring

* Code refactoring

* Code refactoring

* Code refactoring

* Code review changes.

* Removed gradient code for now.

* Code review refactoring.

* Removed gradient code for now.

* Evolving observable removed. Evaluating observables added.

* Code refactoring.

* Improved naming.

* Improved folder structure; filled evolvers init file.

* Added Evolvers to algorithms init file.

* Fixed missing imports.

* Code refactoring

* Fixed cyclic imports.

* Extracted ListOrDict.

* Code refactoring.

* Code refactoring.

* Fixed release note.

* Fixed inheritance order.

* Updated code to the latest time evolution interface.

* Code refactoring.

* Code refactoring.

* Code refactoring.

* Fixed cyclic imports.

* Fixed pylint.

* Name fix.

* Import fix.

* Lint fix.

* Lint fix.

* Code refactoring.

* Extracted and refactored aux_ops_evaluator.py

* Code refactoring

* Implemented unit test.

* Extended unit test.

* Date fixed.

* Reno added.

* Switched to bound ansatz.

* Fix reno.

* Added docs.

* Refactored unit test.

* Lint fixed.

* Code review edits.

* Added unit test cases for dicts.

* Fixed reno reference.

* Improved unit test.

* Added quantum instance support.

* Added support for aux_ops and unit test.

* Fixed input object to eval_observables.

* Fixed quantum_state types and conversion.

* Fixed quantum_state types and conversion.

* Fixed types and docs.

* Code refactoring.

* Lint fix.

* Code refactoring.

* Reno update.

* Code refactoring.

* Implemented some CR feedback.

* evolution_problem.py fix

* Removed trotter_ops_validator.py for now, extended unit tests, code refactoring.

* Updated names of the algorithm.

* Added support for QuantumCircuit input. Code refactoring.

* Improved error handling in evolution_problem.py and unit tests added.

* Code refactoring.

* Cyclic import fix

* Refactored evolution_problem.py

* Refactored test_trotter_qrte.py

* Removed global tolerance.

* CI fix.

* Code review fixes.

* Code refactoring.

* Prepared qasm unit test.

* Removing state eval.

* Refactored and updated tests.

* Added qasm test for aux ops.

* Added param binding test.

* Added missing setters.

* Updated unit tests.

* Improved folder structure.

* Updated interfaces.

* Fix lint.

* Removed legacy (soon) BaseBackend.

* Updated copyright years.

* Added example to reno.

* Fixed reno.

* Removed BaseOperator.

* Code refactoring.

* Imports fix.

* Delayed parameters checks.

* Update qiskit/algorithms/evolvers/evolution_problem.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Code refactoring.

* Update qiskit/algorithms/evolvers/evolution_problem.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Update qiskit/algorithms/evolvers/trotterization/trotter_qrte.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Update qiskit/algorithms/evolvers/trotterization/trotter_qrte.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Update qiskit/algorithms/evolvers/trotterization/trotter_qrte.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Update qiskit/algorithms/evolvers/trotterization/trotter_qrte.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Update qiskit/algorithms/evolvers/trotterization/trotter_qrte.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Update qiskit/algorithms/evolvers/trotterization/trotter_qrte.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Update qiskit/algorithms/evolvers/trotterization/trotter_qrte.py

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Expectation might be None

Co-authored-by: acv@zurich.ibm.com <acv@zurich.ibm.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog mod: algorithms Related to the Algorithms module
Projects
None yet
6 participants