Skip to content

Conversation

@balopat
Copy link
Contributor

@balopat balopat commented Nov 1, 2020

Adds cirq.two_qubit_matrix_to_diagonal_and_operations that extracts a diagonal if it can from a 3CNOT unitary to a diagonal and a 2 CNOT unitary.

Another part of #2873.

@balopat balopat requested a review from viathor November 1, 2020 23:41
@google-cla google-cla bot added the cla: yes Makes googlebot stop complaining. label Nov 1, 2020
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.

Sorry for the delay in review! It's very cool to have this in cirq! Thank you! See comments below.

@balopat balopat requested review from a team, cduck and vtomole as code owners November 26, 2020 02:04
@balopat balopat requested a review from viathor November 26, 2020 02:04
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.

This is very cool! Thank you!

import scipy
import matplotlib.pyplot as plt
import scipy
from scipy.linalg.special_matrices import block_diag
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove line to placate linter

return u @ YY @ u.T @ YY


def extract_right_diag(u: np.ndarray, atol=1e-15) -> np.ndarray:
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove unused atol from signature and Args section of docstring below

@balopat
Copy link
Contributor Author

balopat commented Nov 26, 2020

Thank you for the thorough and insightful review @viathor!!

@balopat balopat added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Nov 26, 2020
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Nov 26, 2020
@CirqBot CirqBot merged commit 5b99b85 into quantumlib:master Nov 26, 2020
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Nov 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Makes googlebot stop complaining.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants