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] Controlled.has_sparse_matrix is incorrect for ops without matrices or sparse matrices #7024

Closed
1 task done
albi3ro opened this issue Feb 28, 2025 · 0 comments · Fixed by #7025
Closed
1 task done
Labels
bug 🐛 Something isn't working

Comments

@albi3ro
Copy link
Contributor

albi3ro commented Feb 28, 2025

Expected behavior

Operator.has_sparse_matrix should agree with whether or not an actual matrix is returned by Operator.sparse_matrix

Actual behavior

Controlled.has_sparse_matrix is always true.

Additional information

No response

Source code

>>> op = qml.ctrl(qml.Permute(np.array([1, 0, 2]), (0, 1, 2)), (3, 4))
>>> op.has_sparse_matrix
True
>>> op.sparse_matrix()
SparseMatrixUndefinedError

Tracebacks

System information

master

Existing GitHub issues

  • I have searched existing GitHub issues to make sure the issue does not already exist.
@albi3ro albi3ro added the bug 🐛 Something isn't working label Feb 28, 2025
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