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

[BUG] qml.center does not work for all linear combinations of Paulis #6048

Closed
1 task done
dwierichs opened this issue Jul 29, 2024 · 0 comments · Fixed by #6049
Closed
1 task done

[BUG] qml.center does not work for all linear combinations of Paulis #6048

dwierichs opened this issue Jul 29, 2024 · 0 comments · Fixed by #6049
Labels
bug 🐛 Something isn't working

Comments

@dwierichs
Copy link
Contributor

Expected behavior

qml.center always computes the center of an algebra.

Actual behavior

If the algebra basis is such that the center elements are linear combinations of them, qml.center does not find them.

Additional information

We need to overlap kernels of adjoint representations instead of commuting basis elements alone.

Source code

>>> dla = qml.lie_closure([qml.X(0), qml.X(1), (qml.X(0)@qml.X(1) + qml.Y(0) @ qml.Y(1) + qml.Z(0)@ qml.Z(1))])
>>> print(dla)
[X(0),
 X(1),
 X(0) @ X(1) + Y(0) @ Y(1) + Z(0) @ Z(1),
 Z(0) @ Y(1) + -1.0 * (Y(0) @ Z(1)),
 -1.0 * (Y(0) @ Y(1)) + -1.0 * (Z(0) @ Z(1))]
>>> qml.center(dla)
[] # Should contain X(0) + X(1)

Tracebacks

No response

System information

pl dev

Existing GitHub issues

  • I have searched existing GitHub issues to make sure the issue does not already exist.
@dwierichs dwierichs added the bug 🐛 Something isn't working label Jul 29, 2024
Shiro-Raven pushed a commit that referenced this issue Aug 7, 2024
**Context:**
Linear combinations were not taken into account in `qml.center`, making
it miss center elements for some inputs.

**Description of the Change:**
Change the algorithm that computes the center.
Kudos to @therooler for the prototype.

**Benefits:**
Correct code.

**Possible Drawbacks:**
~~Slower performance for inputs that would have been fine before
anyways.~~
This has been fixed by reverting to the previous implementation if
`PauliWord` instances are passed only.

**Related GitHub Issues:**
Fixes #6048 
[sc-70014]

---------

Co-authored-by: Thomas R. Bromley <[email protected]>
Co-authored-by: Korbinian Kottmann <[email protected]>
Co-authored-by: Mudit Pandey <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant