-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Apply as_sweep for SqrtCZGauge #6931
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6931 +/- ##
========================================
Coverage 97.87% 97.87%
========================================
Files 1084 1084
Lines 94579 94814 +235
========================================
+ Hits 92568 92799 +231
- Misses 2011 2015 +4 ☔ View full report in Codecov by Sentry. |
033d607
to
785dd6b
Compare
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.
this is great but lets allow some flexiblity when parameterizing two qubit gates
9d66a84
to
77ae6b4
Compare
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. Thanks, Renyi!!
""" | ||
|
||
symbolizer_fn: Callable[ | ||
[ops.Gate, Sequence[sympy.Symbol]], Tuple[ops.Gate, Dict[str, Union[float, 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.
Nit - here and at other instances of Union[float, int]
[ops.Gate, Sequence[sympy.Symbol]], Tuple[ops.Gate, Dict[str, Union[float, int]]] | |
[ops.Gate, Sequence[sympy.Symbol]], Tuple[ops.Gate, Dict[str, numbers.Real]] |
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.
Good point! Done.
In switching to Real, extra code type hinting using isinstance(..., Real)
is necessary as Types from "numbers" aren't supported for static type checking
. So I wonder what is the typical way to determine whether to use float
(should be good enough in most cases as int can naturally be converted to float?), Real
(better generic real number support, easy to switch to Complex?), Union[float, int]
(type checking friendly) in cirq?
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.
@babacry - LGTM with a couple of minor suggestions.
Thank you so much for the valuable suggestions, Pavol! @pavoljuhas |
Example usage:
exec
parameterized_circuit, sweeps = self.gauge_transformer.as_sweep(input_circuit, N=5)
with input_circuit:
output parameterized circuit is:
randomly generalized sweeps