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

Circuit cutting: Remap fragment tape wires to match wires available on device #2257

Merged
merged 14 commits into from
Mar 3, 2022

Conversation

trbromley
Copy link
Contributor

@trbromley trbromley commented Mar 1, 2022

Context:

This PR ensures that N-qubit fragment circuits can be run on N-qubit devices by mapping the wires of the input circuit to match those available in the device.

@codecov
Copy link

codecov bot commented Mar 1, 2022

Codecov Report

Merging #2257 (21f2859) into master (703ae35) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2257   +/-   ##
=======================================
  Coverage   99.31%   99.31%           
=======================================
  Files         237      237           
  Lines       18906    18932   +26     
=======================================
+ Hits        18776    18802   +26     
  Misses        130      130           
Impacted Files Coverage Δ
pennylane/transforms/__init__.py 100.00% <ø> (ø)
pennylane/transforms/qcut.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 703ae35...21f2859. Read the comment docs.

@trbromley trbromley marked this pull request as ready for review March 1, 2022 18:39
Copy link
Contributor

@anthayes92 anthayes92 left a comment

Choose a reason for hiding this comment

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

Thanks for the addition @trbromley!

0: ──RX(0.5)──╭C──╭┤ ⟨Z ⊗ Z⟩
1: ──RY(0.6)──╰X──╰┤ ⟨Z ⊗ Z⟩
"""
if len(tape.wires) > len(wires):
Copy link
Contributor

Choose a reason for hiding this comment

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

should we raise a similar error for the case when len(tape.wires) < len(wires), considering running on hardware but not sure if having an unnecessarily big device is of much consequence?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we do len(tape.wires) < len(wires) then we'd likely often hit an error - e.g., you have a 5-qubit circuit and split into 3 and 2 qubit fragments. We won't be able to run on a 3-qubit device because the 2-qubit fragment will lead to an error.

@trbromley trbromley merged commit fdb5137 into master Mar 3, 2022
@trbromley trbromley deleted the qcut_wire_management branch March 3, 2022 18:46
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.

None yet

3 participants