Skip to content
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

Complete gate zoo and fix gate docs #5344

Merged
merged 6 commits into from
May 12, 2022
Merged

Conversation

dabacon
Copy link
Collaborator

@dabacon dabacon commented May 11, 2022

Completes work for #852

@dabacon dabacon requested review from a team, vtomole and cduck as code owners May 11, 2022 04:43
@dabacon dabacon requested a review from viathor May 11, 2022 04:43
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@CirqBot CirqBot added the size: L 250< lines changed <1000 label May 11, 2022
Copy link
Collaborator

@viathor viathor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with many nits

cirq-core/cirq/ops/boolean_hamiltonian.py Outdated Show resolved Hide resolved
g = exp(i·π·t).
$$
\begin{bmatrix}
1 & 0 & 0 & 0 \\
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This nit applies throughout: A lot of the matrices have few non-zero elements and they are easier to read if the zeros are not explicitly shown:

$$
\begin{bmatrix}
    1 & & & \\
    & 1 & & \\
    & & 1 & \\
    & & & e^{i \pi t} \\
\end{bmatrix}
$$

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this one I'm going to open an issue. I struggled with this myself. For three qubit gates the sparse representation is a definite yes. But I worry a bit that not showing the 0s will confuse users

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cirq-core/cirq/ops/common_gates.py Outdated Show resolved Hide resolved
cirq-core/cirq/ops/diagonal_gate.py Outdated Show resolved Hide resolved
cirq-core/cirq/ops/fourier_transform.py Outdated Show resolved Hide resolved
cirq-core/cirq/ops/fourier_transform.py Outdated Show resolved Hide resolved
cirq-core/cirq/ops/fsim_gate.py Outdated Show resolved Hide resolved
0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & e^{i \pi t}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This is a nice example showing the advantage of implicit zeros I advocated for in another comment. It takes some eye-strain to recognize that this is diagonal.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done here for 3 qubit gates, but left 2 qubit gates in #5359

cirq-core/cirq/ops/three_qubit_gates.py Outdated Show resolved Hide resolved
cirq-core/cirq/ops/two_qubit_diagonal_gate.py Outdated Show resolved Hide resolved
@dabacon dabacon merged commit 15d0fc9 into quantumlib:master May 12, 2022
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: L 250< lines changed <1000
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants