Remove attribute power and default to Power/GateWithRegisters.__pow__#903
Merged
mpharrigan merged 13 commits intoquantumlib:mainfrom May 6, 2024
Merged
Remove attribute power and default to Power/GateWithRegisters.__pow__#903mpharrigan merged 13 commits intoquantumlib:mainfrom
power and default to Power/GateWithRegisters.__pow__#903mpharrigan merged 13 commits intoquantumlib:mainfrom
Conversation
6b43e55 to
7391541
Compare
Contributor
Author
|
@tanujkhattar PTAL |
tanujkhattar
approved these changes
Apr 29, 2024
bfb4d47 to
22f3674
Compare
mpharrigan
reviewed
Apr 29, 2024
mpharrigan
approved these changes
May 1, 2024
d6f8154 to
99482c4
Compare
anurudhp
commented
May 2, 2024
Comment on lines
+466
to
+479
| 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) |
Contributor
Author
There was a problem hiding this comment.
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
Contributor
Author
|
@tanujkhattar @mpharrigan PTAL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_circuit_diagram_info_forControlledandPowerto generate the same custom diagrams as before