-
Notifications
You must be signed in to change notification settings - Fork 44
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
Restrict controlled from non-thru registers #1305
base: main
Are you sure you want to change the base?
Conversation
Left a comment on the original issue - #1304 (comment) |
Let's do this and relax later |
@attrs.frozen | ||
class TestCtrlStatePrepAnd(Bloq): | ||
"""Decomposes into a Controlled-AND gate + int effects & targets where ctrl is active. | ||
|
||
Tensor contraction should give the output state vector corresponding to applying an | ||
`And(and_ctrl)`; assuming all the control bits are active. | ||
""" | ||
|
||
ctrl_spec: CtrlSpec | ||
and_ctrl: Tuple[int, int] |
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 we add a private flag to the Controlled
class, something of the form _THRU_REGISTERS_ONLY = True
, and keep this test around? Since we plan to relax this constraint later, it'll be nice to not delete the test.
@cached_property | ||
def _thru_registers_only(self) -> bool: | ||
for reg in self.subbloq.signature: | ||
if reg.side != Side.THRU: | ||
return False | ||
return True |
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.
See other comment -- it'll be great if we can guard this with a flag set to TRUE by default. When we relax the condition, we can get rid of the flag and also keep the tests around.
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.
LGTM % one request. Please add the restriction controlled by a flag set to TRUE by default.
For #1304
Controlled