-
Notifications
You must be signed in to change notification settings - Fork 575
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
Drawing a ControlledQubitUnitary #1174
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1907,6 +1907,11 @@ def __init__(self, *params, control_wires=None, wires=None, control_values=None, | |
target_dim = 2 ** len(wires) | ||
if len(U) != target_dim: | ||
raise ValueError(f"Input unitary must be of shape {(target_dim, target_dim)}") | ||
|
||
# Saving for the circuit drawer | ||
self.control_wires = control_wires | ||
self.U = U | ||
Comment on lines
+1911
to
+1913
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If these attributes are required by the circuit drawer, we should probably document it somewhere. Are there any other operations that are missing these attributes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
They seem to be specific to
Therefore, introducing We could actually consider separating control and target wires natively for other more defined operations, as it can be convenient to have the separation be available easily.
Indeed, at the moment they are well used by the circuit drawer, but it can easily be that other features will also use them. Any thoughts on where they could be documented? For attributes of operations, we don't seem to have any specific docstrings/docs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is a good question which I don't think has a good answer 🤔 |
||
|
||
wires = control_wires + wires | ||
|
||
# If control values unspecified, we control on the all-ones string | ||
|
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.
Nice :)