-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
add dtype parameter to PauliSumOp.from_list #8896
Conversation
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:
|
04ad868
to
ecf89c0
Compare
Pull Request Test Coverage Report for Build 3884574792
💛 - Coveralls |
ecf89c0
to
a49475b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Could you add the release note please?
BTWm, it might be nice to support Parameters in another PR:
https://github.com/Qiskit/qiskit-terra/blob/6aad91418951484ee5cf808a0c147f96bc951223/qiskit/opflow/primitive_ops/primitive_op.py#L229-L252
While this is certainly better than having to wrap the coefficients into an array, I still think it's not very intuitive for users if they have to explicitly set the dtype when using the parameters. Would checking the type of each coefficient add a noticeable overhead? Isn't the complexity of initializing already linear? 🙂 Otherwise how about allowing to set the dtype for efficiency but checking the type for the user by default? |
The overhead is pretty minimal. But I think it should be done in SparsePauliOp, not PauliSumOp. If that is agreed upon, I can make a PR for that. |
I added the release note. |
@ikkoham what do you think about this, could we check the type of the coeffs on construction? 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge this since specifying the dtype
is required to have the same functionality as the SparsePauliOp
. We can follow-up if we should make the dtype
be derived automatically so we can avoid explicitly setting it to object
for parameters.
* add dtype parameter to PauliSumOp.to_list * add release note Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Summary
This change is needed for PauliSumOp to be able to pass type information to SparsePauliOp.
Details and comments