Skip to content

Conversation

@maffoo
Copy link
Contributor

@maffoo maffoo commented Oct 13, 2020

Also adds a test to ensure we are building the full group with either
decomposition, and use ZXZ to ensure that the XZ decomposition uses only
a single microwave gate per clifford.

Fixes #3411

Also adds a test to ensure we are building the full group with either
decomposition, and use ZXZ to ensure that the XZ decomposition uses only
a single microwave gate per clifford.
@google-cla google-cla bot added the cla: yes Makes googlebot stop complaining. label Oct 13, 2020
@maffoo maffoo requested a review from a team October 14, 2020 18:09
assert rms_err < 0.1


def test_single_qubit_cliffords():
Copy link
Collaborator

Choose a reason for hiding this comment

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

Optional: It seems easy to write a unit test that verifies the key property of the Clifford group - that it fixes the Pauli group - but it seems we don't have it. WDYT about adding it?

(Strictly speaking this isn't related to this PR, but if we had this test then observing it pass before and after would provide a lot of confidence in the new logic.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree we should have some better abstractions around the pauli group and clifford group, but I think I'll leave that as future work because we'll probably need some design discussion around that.

[Y**0.5],
[X**-0.5, Y**-0.5, X**0.5],
[Y, X**0.5],
] # type: List[List[ops.Gate]]
Copy link
Collaborator

@viathor viathor Oct 14, 2020

Choose a reason for hiding this comment

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

nit: Maybe add comments up where Cliffords named tuple type is defined explaining the meaning of the five fields.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed Cliffords to a dataclass and added some documentation about what these are.

assert rms_err < 0.1


def test_single_qubit_cliffords():
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since one of your goals was to ensure at most one microwave gate in each decomposition, could you add a test for this? Otherwise, this can change on you later unexpectedly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. Done.

@maffoo maffoo added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Oct 14, 2020
@CirqBot
Copy link
Collaborator

CirqBot commented Oct 14, 2020

Automerge cancelled: No approved review.

@CirqBot CirqBot removed the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Oct 14, 2020
@maffoo maffoo requested a review from viathor October 14, 2020 19:24
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.

Test is duplicated, see comment. Otherwise, LGTM.

assert num_x <= 1


def test_single_qubit_cliffords_xz_at_most_one_x_gate_per_clifford():
Copy link
Collaborator

Choose a reason for hiding this comment

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

The contents of this test duplicate the one above. I suppose you meant to move the for loop on line 76 above into here (and remove what we have in this test now)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops! Cleaned this up.

@maffoo maffoo merged commit a07b0d2 into master Oct 14, 2020
@maffoo maffoo deleted the u/maffoo/cliffords branch October 14, 2020 19:50
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.

The new Cliffords type is really nice! Thank you!

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.

Single qubit clifford XZ decomposition is missing two Cliffords

3 participants