-
Notifications
You must be signed in to change notification settings - Fork 53
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
cleanup remaining uses of old control specialization interface #1490
cleanup remaining uses of old control specialization interface #1490
Conversation
f0b0dc5
to
56544d6
Compare
@@ -142,6 +142,9 @@ def get_ctrl_system(self, ctrl_spec: 'CtrlSpec') -> Tuple['Bloq', 'AddControlled | |||
def adjoint(self) -> 'Bloq': | |||
return self | |||
|
|||
def _has_unitary_(self): |
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.
Why is this necessary in this PR?
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.
cirq.has_unitary
fails to realize that this is unitary because when it decomposes, it gets And^dagger
gates which aren't unitary (#1488)
@@ -63,7 +62,7 @@ class BernoulliEncoder(SelectOracle, SpecializedSingleQubitControlledExtension): | |||
|
|||
@cached_property | |||
def control_registers(self) -> Tuple[Register, ...]: | |||
return () if self.control_val is None else (Register('control', QBit()),) | |||
return () |
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.
Do we need to keep around this property if it's just empty? (I missed the older PRs so probably need to read those)
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.
SelectOracle
has this as an abstract property, but as there's no special controlled version I just return ()
.
Ideally the select/prepare interfaces should be updated to the newer BlockEncoding
style interfaces (would be a major refactor), but as of now as callees use .control_registers
, I'm keeping it as-is.
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
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
Removes the finally uses of the old
SpecializedSingleQubitControlledExtension
interface in favour of the new interface from #1451.For controlled versions of
LCUBlockEncoding
,SelectBlockEncoding
etc, do not update the subbloqs to controlled. Instead, use the appropriate subbloq/controlled-subbloq when decomposing/building call graph.