Conversation
|
|
||
| Args: | ||
| exponent: The t in gate**t. Determines how much the eigenvalues of | ||
| the gate are scaled by. For example, eigenvectors phased by -1 |
There was a problem hiding this comment.
s/scaled/phased/
The word "scaled" suggests a possible change to absolute value (which does not change - all eigenvalues of a unitary gate have unit absolute value).
There was a problem hiding this comment.
Done, although this phrasing is copied from EigenGate. I'll update it there as well.
|
|
||
| For example, `cirq.X**t` uses a `global_shift` of 0 but | ||
| `cirq.rx(t)` uses a `global_shift` of -0.5, which is why | ||
| `cirq.unitary(cirq.rx(pi))` equals -iX instead of X. |
There was a problem hiding this comment.
Consider updating the formula on line 75 above to account for global shift. Then you can refer to whatever letter you choose to use for global shift in the formula from the description of the argument here. This is what you effectively do on line 98 for exponent=t.
The benefit of this is that it allows the reader to unambiguously identify the gate they will get for given arguments.
There was a problem hiding this comment.
Done, assuming I understood you correctly. PTAL
There was a problem hiding this comment.
Yes, that's exactly it! :-)
I haven't checked that the math is correct. Might be worth calling np.linalg.eig(cirq.unitary(...)) on one of the gates with a few values of exponent and global_shift and check that the eigenvalues are correct.
There was a problem hiding this comment.
(To be clear: I think we do this in unit tests, but doing it manually would give you an opportunity to compare the output against the math in the comment.)
As advertised. Everything except the "dimension" part is copied from the EigenGate constructor docstring. Also opened quantumlib#5647 for adding similar functionality + docs to YPowGate.
As advertised. Everything except the "dimension" part is copied from the EigenGate constructor docstring. Also opened quantumlib#5647 for adding similar functionality + docs to YPowGate.
As advertised. Everything except the "dimension" part is copied from the EigenGate constructor docstring.
Also opened #5647 for adding similar functionality + docs to YPowGate.