-
Notifications
You must be signed in to change notification settings - Fork 140
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
Update to_ising
and from_ising
to support SparsePauliOp
#467
Conversation
Pull Request Test Coverage Report for Build 4732501811
💛 - Coveralls |
I updated the option name from |
2485310
to
5842776
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.
I reviewed the code changes thoroughly and everything looks good to me!
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.
I reviewed the code changes thoroughly and everything looks good to me!
"""Return the Ising Hamiltonian of this problem. | ||
|
||
Variables are mapped to qubits in the same order, i.e., | ||
i-th variable is mapped to i-th qubit. | ||
See https://github.com/Qiskit/qiskit-terra/issues/1148 for details. | ||
|
||
Args: | ||
opflow: The output object is an OpFlow's operator if True. | ||
Otherwise, it is ``SparsePauliOp``. (default: True) |
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.
I think directly stating the default here is easier for an end user - but we will have to remember to update this here too when the default changes. The alternative would be to say the default is determined by the to_ising function and link to that, this is the place that determines it and we have to change next time so if this were done not change would be needed here.
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.
Thank you for your idea. I updated it to refer to to_ising
function. cc41551
.. note:: | ||
|
||
The default value of ``opflow`` argument is currently set ``True``, but it will | ||
first be changed to ``False`` and then deprecated in future releases. |
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.
Just as a note given opflow is planned for deprecation in the upcoming Terra 0.24 release it would be removed in 0.26 two releases later. At that time this parameter can still exist but will be need to be ignored since there will no longer be any opflow logic in Terra. I guess we can consider updating this note when its changed over to False next time based on how things will progress.
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.
Yes, we need to update it depending on the opflow deprecation status of Terra in the future.
The ``qubit_op`` argument can currently accept Opflow operators, but it has been | ||
superseded by ``SparsePauliOp``. | ||
Opflow will be deprecated in a future release and subsequently removed after that. |
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.
The ``qubit_op`` argument can currently accept Opflow operators, but it has been | |
superseded by ``SparsePauliOp``. | |
Opflow will be deprecated in a future release and subsequently removed after that. | |
The ``qubit_op`` argument can currently accept Opflow operators (OperatorBase type), but have been | |
superseded by Qiskit Terra quantum info BaseOperators such as ``SparsePauliOp``. | |
Opflow operator support will be deprecated in a future release and subsequently removed after that. |
Here is accepts all quantum info BaseOperator types right. Most often it will be SparsePauliOp bit its not restricted to this. I will also note that we can make these class references since we have the intersphinx with Terra.
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.
Thanks. I include it. cc41551
"The `qubit_op` argument can currently accept Opflow operators, but it has been " | ||
"superseded by `SparsePauliOp`. " | ||
"Opflow will be deprecated in a future release and subsequently removed after that.", |
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.
I did not alter the text here as per he above suggestion. But if the suggestion seems better then perhaps this should be the same.
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.
Thanks. I include it. cc41551
Updated :func:`~.to_ising` to support ``qiskit.quantum_info.SparsePauliOp``. | ||
Added ``opflow`` argument to :func:`~.to_ising` to control the output is | ||
opflow operator (if ``True``) or ``SparsePauliOp`` (if ``False``). | ||
The default value of ``opflow`` argument is currently ``True``, but it will | ||
first be changed to ``False`` and then deprecated in future releases. |
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.
Updated :func:`~.to_ising` to support ``qiskit.quantum_info.SparsePauliOp``. | |
Added ``opflow`` argument to :func:`~.to_ising` to control the output is | |
opflow operator (if ``True``) or ``SparsePauliOp`` (if ``False``). | |
The default value of ``opflow`` argument is currently ``True``, but it will | |
first be changed to ``False`` and then deprecated in future releases. | |
Updated :func:`~.to_ising` to support optionally returning ``qiskit.quantum_info.SparsePauliOp``. | |
This is achieved by a new ``opflow`` argument to :func:`~.to_ising` to control if the output is | |
the opflow operator, as has been done in the past, (if ``True``) or ``SparsePauliOp`` (if ``False``). | |
The default value of ``opflow`` argument is currently ``True``, but it will | |
first be changed to ``False``. The parameter will be deprecated and removed in a future release. |
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.
Thanks. I include it. cc41551
Updated :func:`~.from_ising` to support ``qiskit.quantum_info.SparsePauliOp``. | ||
``qubit_op`` argument can currently accept opflow operators, | ||
but it has been superseded by ``SparsePauliOp``. | ||
Opflow will be deprecated in a future release and subsequently removed after that. |
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.
This text is similar again to the suggestion made for the from_ising note. So again is thats ok probably we want the same/similar here too.
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.
Thanks. I include it. cc41551
Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
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.
LGTM. I see the release note has a minor spelling mistake in its name support-sprase-pauli-op
where its sprase
instead of sparse
- but since the name never shows up anywhere outside of looking at the files themselves it's of little consequence.
Good catch. But, it is a bit complicated to rename reno. So, I will merge it without renaming it. |
Summary
opflow
option toto_ising
to control the output isSparsePauliOp
or Opflow's operator.from_ising
to receivequantum_info
's operators.This is part of #433.
The legacy minimum eigensolver of Terra supports only opflow (not
SparsePauliOp
).We will deprecate the legacy minimum eigensover and opflow when they are deprecated in Terra.
Details and comments