PyZX Interop: Converting bloqs to pyzx circuits#1550
Open
anurudhp wants to merge 7 commits intoquantumlib:mainfrom
Open
PyZX Interop: Converting bloqs to pyzx circuits#1550anurudhp wants to merge 7 commits intoquantumlib:mainfrom
anurudhp wants to merge 7 commits intoquantumlib:mainfrom
Conversation
This was referenced Feb 13, 2025
Contributor
Author
|
@tanujkhattar ptal |
mpharrigan
reviewed
Feb 26, 2025
Collaborator
mpharrigan
left a comment
There was a problem hiding this comment.
looks reasonable -- some comments
| def __str__(self): | ||
| return self.__class__.__name__ | ||
|
|
||
| def as_zx_gates( |
Collaborator
There was a problem hiding this comment.
this need a big docstring (as all top level bloq methods)
| """A mapping from register names to an NDArray of ZX qubits""" | ||
|
|
||
|
|
||
| @define |
Collaborator
There was a problem hiding this comment.
can this be frozen? if yes: make it so; if no, use attrs.mutable and explain why in docstring
Comment on lines
+107
to
+108
| except NotImplementedError: | ||
| pass |
Collaborator
There was a problem hiding this comment.
This is so we fall back to the decomposition-based approach? Maybe some line comments could help guide the reader to the order of strategies
| except NotImplementedError: | ||
| pass | ||
|
|
||
| cbloq = bloq.decompose_bloq() |
Collaborator
There was a problem hiding this comment.
consider supporting the case where bloq is a composite bloq
| for j in range(cxn.left.reg.bitsize): | ||
|
|
||
| placeholder = Soquet(None, Register('simulation_placeholder', QBit())) # type: ignore | ||
| Connection(cxn.left, placeholder) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First step towards #1517
bloq_to_pyzx_circuitto generate a pyzx Circuit, which can then be converted to a pyzx graph using.to_graph().ZGate, XGate, _ZVector)