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

Add function to load Qiskit operators #5251

Merged
merged 15 commits into from
Feb 23, 2024
Merged

Conversation

Mandrenkov
Copy link
Contributor

@Mandrenkov Mandrenkov commented Feb 22, 2024

Context:

The next release of the PennyLane-Qiskit plugin will include PennyLaneAI/pennylane-qiskit#401 which features a new function for converting Qiskit SparsePauliOp instances into PennyLane operators.

Description of the Change:

  • Added a from_qiskit_op() function to the IO module for loading Qiskit operators.

In a nutshell,

>>> import pennylane as qml
>>> from qiskit.quantum_info import SparsePauliOp
>>> qiskit_op = SparsePauliOp(["II", "XY"])
>>> qml.from_qiskit_op(qiskit_op)
I(0) + X(1) @ Y(0)

Benefits:

  • Qiskit operators can be directly converted into PennyLane operators.

Possible Drawbacks:

None.

Related GitHub Issues:

None.

Copy link

codecov bot commented Feb 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (master@880b9da). Click here to learn what that means.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #5251   +/-   ##
=========================================
  Coverage          ?   99.67%           
=========================================
  Files             ?      399           
  Lines             ?    36583           
  Branches          ?        0           
=========================================
  Hits              ?    36465           
  Misses            ?      118           
  Partials          ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Mandrenkov Mandrenkov marked this pull request as ready for review February 23, 2024 13:03
@Mandrenkov Mandrenkov requested review from lillian542 and trbromley and removed request for lillian542 February 23, 2024 13:03
Copy link
Contributor

@trbromley trbromley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Mandrenkov!

pennylane/io.py Outdated Show resolved Hide resolved
pennylane/io.py Outdated Show resolved Hide resolved
pennylane/io.py Outdated Show resolved Hide resolved
pennylane/io.py Show resolved Hide resolved
pennylane/io.py Outdated Show resolved Hide resolved
@trbromley trbromley added this to the v0.35 milestone Feb 23, 2024
@Mandrenkov
Copy link
Contributor Author

Thanks for the review, @trbromley!

Copy link
Contributor

@lillian542 lillian542 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good to me, and all seems to be working well in a Jupyter notebook. Just let me know when its ready for a final review!

doc/releases/changelog-dev.md Outdated Show resolved Hide resolved
pennylane/io.py Outdated Show resolved Hide resolved
pennylane/io.py Show resolved Hide resolved
Copy link
Contributor

@trbromley trbromley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Mandrenkov!!

doc/releases/changelog-dev.md Show resolved Hide resolved
pennylane/io.py Show resolved Hide resolved
@Mandrenkov
Copy link
Contributor Author

Thanks for all the feedback, @trbromley!

Copy link
Contributor

@lillian542 lillian542 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks @Mandrenkov! 🚀

@timmysilv timmysilv added the merge-ready ✔️ All tests pass and the PR is ready to be merged. label Feb 23, 2024
@Mandrenkov Mandrenkov enabled auto-merge (squash) February 23, 2024 21:05
@Mandrenkov Mandrenkov merged commit 6ff7a1f into master Feb 23, 2024
39 checks passed
@Mandrenkov Mandrenkov deleted the sc-56187-from-qiskit-op branch February 23, 2024 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-ready ✔️ All tests pass and the PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants