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

Make qml.Qubitization QJIT compatible #6305

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open

Conversation

willjmax
Copy link
Contributor

Catalyst does not support passing a list of wires into the identity operator, so the following code causes a segmentation fault qml.Identity([0, 1]) To make this template QJIT compatible we need to build the Identity operator as a tensor product of single wire Identity operators instead of passing in a list of wires. This PR addresses [sc-74444].

Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

Copy link

codecov bot commented Sep 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.70%. Comparing base (be676fe) to head (160b76a).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6305   +/-   ##
=======================================
  Coverage   99.70%   99.70%           
=======================================
  Files         444      444           
  Lines       42223    42224    +1     
=======================================
+ Hits        42100    42101    +1     
  Misses        123      123           

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

decomp_ops.append(qml.Reflection(qml.Identity(control)))
# QJIT is not compatible with qml.Identity(control), so we build the
# identity as a tensor product instead
identity = qml.prod(*[qml.Identity(wire) for wire in control])
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to do this always or only when used in a QJIT setting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's only needed for QJIT. Doing something like qml.Identity(list_of_wires) is not supported, so the identity operator needs to be built another way.

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

Successfully merging this pull request may close these issues.

2 participants