U3 gate not working with a CompilerError
babreu-ncsa opened this issue · 2 comments
babreu-ncsa commented
Required prerequisites
- 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.
- Make sure you've read the documentation. Your issue may be addressed there.
- 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
The
Steps to reproduce the bug
import cudaq
import numpy as np
@cudaq.kernel
def tryu3():
qubit = cudaq.qubit()
u3(np.pi/4., np.pi/3, np.pi/5, qubit)
result = cudaq.sample(tryu3, shots_count=2**12)
returns
CompilerError: 3854654959.py:4: error: unhandled function call - u3, known kernels are dict_keys([])
(offending source -> u3(np.pi / 4.0, np.pi / 3, np.pi / 5, qubit))
Expected behavior
It should work since it is documented. I do see a note about it being available for simulation only, not sure if it's related. Also, the u3
call needs to be fixed to u3(np.pi, np.pi, np.pi / 2, qubit)
since the qubit was defined by the variable qubit
in the line above, not q
.
Is this a regression? If it is, put the last known working version (or commit) here.
Not a regression
Environment
- CUDA Quantum version: 0.7.0
- Python version: 3.9.18
- C++ compiler: gcc/11.4.0
- Operating system: Red Hat Enterprise Linux 8.8
Suggestions
No response
babreu-ncsa commented
It also does not work outside a kernel:
qubit = cudaq.qubit()
u3(np.pi, np.pi, np.pi / 2, qubit)
gives
NameError: name 'u3' is not defined
babreu-ncsa commented
Nevermind! I found the issue.... u3
is not on v0.7.0!