-
Notifications
You must be signed in to change notification settings - Fork 50
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
Remove attribute power
and default to Power
/GateWithRegisters.__pow__
#903
Remove attribute power
and default to Power
/GateWithRegisters.__pow__
#903
Conversation
6b43e55
to
7391541
Compare
@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.
LGTM % comments
qualtran/bloqs/mean_estimation/mean_estimation_operator_test.py
Outdated
Show resolved
Hide resolved
bfb4d47
to
22f3674
Compare
d6f8154
to
99482c4
Compare
def _circuit_diagram_info_(self, args: cirq.CircuitDiagramInfoArgs) -> cirq.CircuitDiagramInfo: | ||
from qualtran.cirq_interop._bloq_to_cirq import _wire_symbol_to_cirq_diagram_info | ||
|
||
if isinstance(self.subbloq, cirq.Gate): | ||
sub_info = cirq.circuit_diagram_info(self.subbloq, args, None) | ||
if sub_info is not None: | ||
cv_info = cirq.circuit_diagram_info(self.ctrl_spec.to_cirq_cv()) | ||
|
||
return cirq.CircuitDiagramInfo( | ||
wire_symbols=(*cv_info.wire_symbols, *sub_info.wire_symbols), | ||
exponent=sub_info.exponent, | ||
) | ||
|
||
return _wire_symbol_to_cirq_diagram_info(self, args) |
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.
One change after the approval: I had to add a special case here because _wire_symbol_to_cirq_diagram_info
doesn't recurse into the subgate. eg. XPowGate(0.25).controlled()
was rendering X
instead of X^0.25
.
I added tests now to check that this works correctly
@tanujkhattar @mpharrigan PTAL |
_circuit_diagram_info_
forControlled
andPower
to generate the same custom diagrams as before