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

Deprecate PauliTransform #5498

Merged
merged 7 commits into from
Jun 16, 2022

Conversation

dstrain115
Copy link
Collaborator

  • PauliTransform is only used with SingleQubitCliffordGate,
    is not easily extensible for multi-qubit gates, and has
    been obsoleted by DensePauliString

Fixes: #4088

- PauliTransform is only used with SingleQubitCliffordGate,
is not easily extensible for multi-qubit gates, and has
been obsoleted by DensePauliString

Fixes: quantumlib#4088
@dstrain115 dstrain115 requested review from a team, vtomole and cduck as code owners June 13, 2022 19:55
@dstrain115 dstrain115 requested a review from mpharrigan June 13, 2022 19:55
@CirqBot CirqBot added the size: M 50< lines changed <250 label Jun 13, 2022
Copy link
Collaborator

@dabacon dabacon left a comment

Choose a reason for hiding this comment

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

One question

if x_to is None or z_to is None:
return None
return SingleQubitCliffordGate.from_clifford_tableau(
_to_clifford_tableau(x_to=x_to, z_to=z_to)
)

def transform(self, pauli: Pauli) -> PauliTransform:
def transform(self, pauli: Pauli) -> Tuple[Pauli, bool]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

this return type is a bit odd. Should it be a dense pauli string?

Also is this a breaking change?

Probably should at least be documented.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Making this into a DensePauliString introduces all sorts of circular dependencies, since DensePauliString depends on SingleQubitCliffordGate, and it is tricky to work around this. I could do this if we have inline imports though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I changed this a bit. I deprecated transform() but kept the return type the same. I then added two functions (pauli_tuple()) which is the named tuple without the name, and dense_pauli_string which is the pauli_string). What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Much better.

Copy link
Collaborator

Choose a reason for hiding this comment

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

My only thought is that after deprecation, when we remove PauliTransform it might make sense to still use it or a named tuple, as these [0] and [1]s are a bit hard to read. You could do that now, or you could wait, since it doesn't impact the public API either is good by me.

@dstrain115 dstrain115 added the BREAKING CHANGE For pull requests that are important to mention in release notes. label Jun 14, 2022
@dstrain115 dstrain115 requested a review from dabacon June 14, 2022 21:35
Copy link
Collaborator

@dabacon dabacon 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 one question about how you want to handle the fix after deprecation.

@dstrain115 dstrain115 added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jun 16, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jun 16, 2022
@CirqBot CirqBot merged commit b1a5d23 into quantumlib:master Jun 16, 2022
@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 Jun 16, 2022
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
- PauliTransform is only used with SingleQubitCliffordGate,
is not easily extensible for multi-qubit gates, and has
been obsoleted by DensePauliString

Fixes: quantumlib#4088
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
- PauliTransform is only used with SingleQubitCliffordGate,
is not easily extensible for multi-qubit gates, and has
been obsoleted by DensePauliString

Fixes: quantumlib#4088
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BREAKING CHANGE For pull requests that are important to mention in release notes. size: M 50< lines changed <250
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate PauliTransform?
3 participants