-
Notifications
You must be signed in to change notification settings - Fork 209
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
Refactor BaseProblem.second_q_ops()
#772
Merged
mrossinek
merged 4 commits into
qiskit-community:main
from
mrossinek:refactor-second_q_ops
Aug 12, 2022
Merged
Refactor BaseProblem.second_q_ops()
#772
mrossinek
merged 4 commits into
qiskit-community:main
from
mrossinek:refactor-second_q_ops
Aug 12, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mrossinek
requested review from
stefan-woerner,
manoelmarques and
woodsp-ibm
as code owners
August 6, 2022 13:48
mrossinek
force-pushed
the
refactor-second_q_ops
branch
from
August 6, 2022 14:05
a890f2d
to
7db0954
Compare
mrossinek
force-pushed
the
refactor-second_q_ops
branch
from
August 6, 2022 14:19
7db0954
to
f995e28
Compare
This removes the usage of ListOrDict wherever possible. The QubitConverter class is the last place this is needed, because the UCC and UVCC ansatze pass their excitation operators for conversion as a list. That is fine for now, but may be improved when tackling qiskit-community#771
The algorithms in Terra always take a tuple of the main operator and some auxiliary operators. This commit changes the `BaseProblem` interface to already return the generated operators in the same format. This simplifies the handling of the main operator, a scenario that occurs very often and required manual intervention thus far.
mrossinek
force-pushed
the
refactor-second_q_ops
branch
from
August 6, 2022 14:38
f995e28
to
1e14e1d
Compare
2 tasks
woodsp-ibm
reviewed
Aug 10, 2022
woodsp-ibm
reviewed
Aug 10, 2022
qiskit_nature/second_q/algorithms/excited_states_solvers/excited_states_eigensolver.py
Show resolved
Hide resolved
woodsp-ibm
previously approved these changes
Aug 12, 2022
woodsp-ibm
approved these changes
Aug 12, 2022
Anthony-Gandon
pushed a commit
to Anthony-Gandon/qiskit-nature
that referenced
this pull request
May 25, 2023
* refactor: enable dict_aux_operators by default * refactor: deprecate qiskit_nature.ListOrDict This removes the usage of ListOrDict wherever possible. The QubitConverter class is the last place this is needed, because the UCC and UVCC ansatze pass their excitation operators for conversion as a list. That is fine for now, but may be improved when tackling qiskit-community#771 * refactor: match return type of `BaseProblem.second_q_ops()` to Terra The algorithms in Terra always take a tuple of the main operator and some auxiliary operators. This commit changes the `BaseProblem` interface to already return the generated operators in the same format. This simplifies the handling of the main operator, a scenario that occurs very often and required manual intervention thus far.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
This PR is another self-container step part of #701.
It refactors the
BaseProblem.second_q_ops()
method to produce a tuple, with the first element being the main operator, and the second element a dictionary of auxiliary operators. This matches the input expected by Terra algorithms and avoids the common need of extracting the main operator from one larger dictionary of operators.Details and comments
This PR also enables
settings.dict_aux_operators
by default and deprecatesListOrDict
since Qiskit Nature will always be producing dictionaries of auxiliary operators in the new stack/workflow.