qiskit icon indicating copy to clipboard operation
qiskit copied to clipboard

Implements VarQTE algorithm with primitives.

Open dlasecki opened this issue 2 years ago • 2 comments

Summary

This PR implements the VarQTE algorithm with primitives - it uses primitive-enabled QFI and gradients.

Closes: #8485.

Details and comments

This PR depends on #8683 and #8688 and some deprecations-related PRs which need to be merged before this PR. Please ignore files related to these PRs that appear in this PR.

In the current stage the feature does not work yet and further adjustments are needed. Here are the major ones:

  • [x] Unify all the signatures across the algorithm.
  • [x] Add higher-level primitives as arguments in entry points.
  • [ ] Update unit tests to the new version and assure correctness.
  • [x] Reduce the use of opflow.
  • [ ] Clean CI.
  • [x] Remove old VarQTE (variational package) - no deprecation needed because it was never released. Done by #8750

dlasecki avatar Sep 14 '22 08:09 dlasecki

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:

  • @Cryoris
  • @Qiskit/terra-core
  • @ajavadia
  • @ikkoham
  • @levbishop
  • @manoelmarques
  • @t-imamichi
  • @woodsp-ibm

qiskit-bot avatar Sep 14 '22 08:09 qiskit-bot

Pull Request Test Coverage Report for Build 3953584504

  • 427 of 453 (94.26%) changed or added relevant lines in 35 files are covered.
  • 11 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.02%) to 84.891%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/algorithms/time_evolvers/variational/solvers/ode/abstract_ode_function.py 15 16 93.75%
qiskit/algorithms/time_evolvers/variational/solvers/ode/ode_function_factory.py 19 20 95.0%
qiskit/algorithms/time_evolvers/variational/var_qite.py 18 19 94.74%
qiskit/algorithms/time_evolvers/variational/solvers/ode/forward_euler_solver.py 18 21 85.71%
qiskit/algorithms/time_evolvers/variational/solvers/var_qte_linear_solver.py 43 46 93.48%
qiskit/algorithms/time_evolvers/variational/var_qte.py 75 78 96.15%
qiskit/algorithms/time_evolvers/variational/variational_principles/variational_principle.py 22 25 88.0%
qiskit/algorithms/time_evolvers/variational/variational_principles/imaginary_mc_lachlan_principle.py 33 37 89.19%
qiskit/algorithms/time_evolvers/variational/variational_principles/real_mc_lachlan_principle.py 46 53 86.79%
<!-- Total: 427 453
Files with Coverage Reduction New Missed Lines %
qiskit/pulse/library/waveform.py 3 91.67%
src/vf2_layout.rs 8 86.44%
<!-- Total: 11
Totals Coverage Status
Change from base Build 3953361416: 0.02%
Covered Lines: 66350
Relevant Lines: 78159

💛 - Coveralls

coveralls avatar Sep 14 '22 09:09 coveralls

Sorry for the overload of changed files. from qiskit.algorithms import AlgorithmJob, AlgorithmError in the gradients were creating cyclic import issues all over the time evolvers module. Making the imports relative was the only solution I could find.

ElePT avatar Jan 17 '23 17:01 ElePT

Sorry for the overload of changed files. from qiskit.algorithms import AlgorithmJob, AlgorithmError in the gradients were creating cyclic import issues all over the time evolvers module. Making the imports relative was the only solution I could find.

From what I can see its more the direct importing from the module rather than the init file. In one case it was already relative (i.e. ..) but was changed to ..\algorithm_job. I think doing the import like that (i.e. from algorithm_job directly) in an absolute sense works just as well.

woodsp-ibm avatar Jan 17 '23 20:01 woodsp-ibm

Thank you @woodsp-ibm for your review. I have tried to implement all the changes you suggested, including using Sequence and Mapping when possible, listing public attributes as such in the docstrings, adding VarQTE and VarQTEResult to the docs, removing imprecise defaults to None.

ElePT avatar Jan 18 '23 19:01 ElePT