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

Change ValueError to assertion in clifford_optimize #5060

Merged
merged 3 commits into from
Mar 8, 2022

Conversation

daxfohl
Copy link
Contributor

@daxfohl daxfohl commented Mar 8, 2022

Fixes #2962

@dabacon hunch was correct. The coefficient is initialized at 1, and can only be negated. Changed the error to an assertion accordingly,

coef = -self._coefficient if should_negate else self.coefficient

Update: Removed the assertion entirely since that assertion already exists in PauliStringPhasor.__init__

@daxfohl daxfohl requested review from a team, vtomole and cduck as code owners March 8, 2022 15:03
@daxfohl daxfohl requested a review from dabacon March 8, 2022 15:03
@CirqBot CirqBot added the size: S 10< lines changed <50 label Mar 8, 2022
@vtomole vtomole added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Mar 8, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Mar 8, 2022
@CirqBot
Copy link
Collaborator

CirqBot commented Mar 8, 2022

Automerge cancelled: A required status check is not present.

Missing statuses: ['Pytest Windows (3.7)', 'Pytest Windows (3.8)', 'Pytest Windows (3.9)', 'Typescript lint check', 'Typescript tests', 'Typescript tests coverage']

@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 Mar 8, 2022
@vtomole vtomole added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Mar 8, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Mar 8, 2022
@CirqBot CirqBot merged commit 785c5c1 into quantumlib:master Mar 8, 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 Mar 8, 2022
@daxfohl daxfohl deleted the pauliopt branch March 9, 2022 00:37
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
Fixes quantumlib#2962

@dabacon hunch was correct. The coefficient is initialized at 1, and can only be negated. Changed the error to an assertion accordingly,

https://github.com/quantumlib/Cirq/blob/9cefed8c384dc8a6751e4fe114873bf349160721/cirq-core/cirq/ops/pauli_string.py#L946

Update: Removed the assertion entirely since that assertion already exists in `PauliStringPhasor.__init__`
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
Fixes quantumlib#2962

@dabacon hunch was correct. The coefficient is initialized at 1, and can only be negated. Changed the error to an assertion accordingly,

https://github.com/quantumlib/Cirq/blob/9cefed8c384dc8a6751e4fe114873bf349160721/cirq-core/cirq/ops/pauli_string.py#L946

Update: Removed the assertion entirely since that assertion already exists in `PauliStringPhasor.__init__`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: S 10< lines changed <50
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clifford optimize either should support more general pauli phases or make assert
3 participants