Skip to content

Conversation

itoko
Copy link
Contributor

@itoko itoko commented Sep 27, 2023

Summary

Fix a bug where Clifford.from_operator (from_matrix) does not fail with non-Clifford diagonal operators (matrices) and return incorrect Clifford objects. This commit corrects it to raise an error as expected.
Fix #10903

Details and comments

Each non-zero element of the Pauli matrices computed during the conversion must be one of {1, -1, 1j, -1j} for valid input but that was not fully checked and failed to raise an error against invalid non-Clifford diagonal matrices.

@itoko itoko requested review from ikkoham and a team as code owners September 27, 2023 09:47
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core
  • @ikkoham

@mtreinish mtreinish added Changelog: Bugfix Include in the "Fixed" section of the changelog stable backport potential The bug might be minimal and/or import enough to be port to stable labels Sep 27, 2023
@mtreinish mtreinish added this to the 0.25.2 milestone Sep 27, 2023
@ikkoham ikkoham added the mod: quantum info Related to the Quantum Info module (States & Operators) label Sep 28, 2023
Copy link
Contributor

@ikkoham ikkoham left a comment

Choose a reason for hiding this comment

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

Thank you for fixing the bug. LGTM. (I discussed this PR with Itoko-san offline.)

@jakelishman jakelishman added this pull request to the merge queue Sep 28, 2023
Merged via the queue into Qiskit:main with commit daf3f4e Sep 28, 2023
mergify bot pushed a commit that referenced this pull request Sep 28, 2023
…rs (#10904)

* Fix a bug in Clifford.from_matrix and from_operator

* Minor change in a comment

(cherry picked from commit daf3f4e)
github-merge-queue bot pushed a commit that referenced this pull request Sep 28, 2023
…rs (#10904) (#10910)

* Fix a bug in Clifford.from_matrix and from_operator

* Minor change in a comment

(cherry picked from commit daf3f4e)

Co-authored-by: Toshinari Itoko <15028342+itoko@users.noreply.github.com>
rupeshknn pushed a commit to rupeshknn/qiskit that referenced this pull request Oct 9, 2023
…rs (Qiskit#10904)

* Fix a bug in Clifford.from_matrix and from_operator

* Minor change in a comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog mod: quantum info Related to the Quantum Info module (States & Operators) stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clifford.from_operator does not fail with non-Clifford diagonal operator
5 participants