Skip to content
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

Replace opflow operators with quantum_info SparsePauliOp #433

Closed
t-imamichi opened this issue Nov 10, 2022 · 3 comments
Closed

Replace opflow operators with quantum_info SparsePauliOp #433

t-imamichi opened this issue Nov 10, 2022 · 3 comments

Comments

@t-imamichi
Copy link
Collaborator

What is the expected enhancement?

As primitive-based algorithm is rolled out and opflow might be deprecated in the future, we might need to update Qiskit-optimization to replace opflow operators with SparsePauliOp of quantum_info.
For example, to_ising returns PauliSumOp and from_ising receives PauliSumOp.

@woodsp-ibm
Copy link
Member

I imagine we can transition over already to some degree if we choose. For from_ising we could probably support conversion for both the opflow OperatorBase and the quantum_info BaseOperator with the former type being deprecated, so things can be transitioned over. For to_ising maybe add an additional parameter that presently defaults to producing an OperatorBase (PauliSumOp), so any users code still works, but set it via when optimization uses it internally so it goes over to producing an OperatorBase - SparsePauliOp. Maybe this new parameter will be removed when only OperatorBase is emitted. I guess as far as the optimization stack is concerned its use of to_ising is all internal and can just be switched based on the algorithm, whether it be older QI based ones, so users existing code continues to work or the new primitive based ones that can take a BaseOperator directly - at least it looks that way for the minimum eigen optimizer. Of course the new primitive based algos still work with PaulisSumOp so switching at present is not strictly needed. But for the public API of to/from_ising it would probably be better to additionally do it a new way while supporting the old. Please note that with the new primitive Terra NumPy(Minimum)Eigensolver there is presently a bug Qiskit/qiskit#9101

@t-imamichi
Copy link
Collaborator Author

Thank you for the feedback. Yes, we have to update the code without breaking user codes. I intend to work on it when opflow is deprecated and the new primitive-based algorithms get stable.

@t-imamichi
Copy link
Collaborator Author

done by #542

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants