Skip to content

Replaced deprecated Qiskit classes by their respective replacement functions #237

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

Merged
merged 6 commits into from
Aug 12, 2025

Conversation

tnemoz
Copy link
Contributor

@tnemoz tnemoz commented Aug 7, 2025

Summary

Fixes #231.

This PR replaces most of the uses of the deprecated classes based on BlueprintCircuit by their function counterpart. Some are left in tests, and EvolvedOperatorAnsatz is still used in AdaptVQE.

VQD, VQE and SamplingVQE now raise warnings upon setting the number of qubits of their ansatz.

Since it seems that PhaseOracle will be deprecated in Qiskit 2.2 in profit of PhaseOraclegate, I went ahead and added support for the latter in AmplificationProblem and Grover.

Concerning AdaptVQE, following the discussion in #231, I went for adding a lot of keyword-only arguments. This allows for instantiating it using the new technique without too much code, just like the user would have instantiated its EvolvedOperatorAnsatz. There's a concern on the typing of VQE ansatz though. On the one hand, I don't really like allowing the ansatz to be None since I don't think it makes much sense, but on the other hand it's a bit ridiculous to pass QuantumCircuit(1) to VQE... Note that this is a typing-only problem: if the user actually passes None for the ansatz, it will work just fine.

@coveralls
Copy link

coveralls commented Aug 7, 2025

Pull Request Test Coverage Report for Build 16850750011

Details

  • 49 of 50 (98.0%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.06%) to 90.194%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit_algorithms/minimum_eigensolvers/adapt_vqe.py 37 38 97.37%
Totals Coverage Status
Change from base Build 16793992272: 0.06%
Covered Lines: 6659
Relevant Lines: 7383

💛 - Coveralls

Copy link
Member

@woodsp-ibm woodsp-ibm left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for doing this - another great piece of work!

@woodsp-ibm woodsp-ibm merged commit aa7179c into qiskit-community:main Aug 12, 2025
16 of 18 checks passed
@tnemoz tnemoz deleted the fix231 branch August 12, 2025 13:47
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.

Qiskit Circuit Library deprecations
3 participants