Replaced deprecated Qiskit classes by their respective replacement functions #237
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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, andEvolvedOperatorAnsatz
is still used inAdaptVQE
.VQD
,VQE
andSamplingVQE
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 ofPhaseOraclegate
, I went ahead and added support for the latter inAmplificationProblem
andGrover
.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 itsEvolvedOperatorAnsatz
. There's a concern on the typing ofVQE
ansatz though. On the one hand, I don't really like allowing the ansatz to beNone
since I don't think it makes much sense, but on the other hand it's a bit ridiculous to passQuantumCircuit(1)
toVQE
... Note that this is a typing-only problem: if the user actually passesNone
for the ansatz, it will work just fine.