-
Notifications
You must be signed in to change notification settings - Fork 58
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
PyZX Interop: Converting bloqs to pyzx circuits #1550
base: main
Are you sure you want to change the base?
Conversation
@tanujkhattar ptal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks reasonable -- some comments
@@ -551,3 +554,8 @@ def wire_symbol( | |||
|
|||
def __str__(self): | |||
return self.__class__.__name__ | |||
|
|||
def as_zx_gates( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this need a big docstring (as all top level bloq methods)
"""A mapping from register names to an NDArray of ZX qubits""" | ||
|
||
|
||
@define |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be frozen? if yes: make it so; if no, use attrs.mutable
and explain why in docstring
except NotImplementedError: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider supporting the case where bloq
is a composite bloq
placeholder = Soquet(None, Register('simulation_placeholder', QBit())) # type: ignore | ||
Connection(cxn.left, placeholder) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol
First step towards #1517
bloq_to_pyzx_circuit
to generate a pyzx Circuit, which can then be converted to a pyzx graph using.to_graph()
.ZGate, XGate, _ZVector
)