cuda-quantum
cuda-quantum copied to clipboard
Issue using custom unitary operations with incorrect matrices
Required prerequisites
- [X] Consult the security policy. If reporting a security vulnerability, do not report the bug using this form. Use the process described in the policy to report the issue.
- [X] Make sure you've read the documentation. Your issue may be addressed there.
- [X] Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
- [ ] If possible, make a PR with a failing test to give us a starting point to work on!
Describe the bug
Trying to register a custom unitary with a matrix that is not sized correctly (ie not 2^n x 2^n) gives an unclear error message (Assertion error)
Steps to reproduce the bug
def register_custom_operation(unitary_index: int, matrix: np.ndarray):
cudaq.register_operation(f"U_{unitary_index}", matrix)
matrix = np.identity(3)
register_custom_operation(0, matrix)
Expected behavior
Clear error message
Is this a regression? If it is, put the last known working version (or commit) here.
Not a regression
Environment
- CUDA Quantum version:
- Python version:
- C++ compiler:
- Operating system:
Suggestions
No response