Assertion error when attempting to use len()
justinlietz opened this issue · 0 comments
justinlietz 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
cudaq.qvector
supports the .size()
function, but if the user mistakenly uses len()
the error that is return is:
AssertionError
which is not enough to diagnose the problem.
Steps to reproduce the bug
import cudaq
@cudaq.kernel
def test_kernel(nCountingQubits: int):
qubits = cudaq.qvector(nCountingQubits)
# N = counting_qubits.size()
N = len(qubits)
h(qubits)
nQubits = 4
print(cudaq.draw(test_kernel, nQubits))
Expected behavior
Expected behavior would be to either support len()
as well as .size()
or throw an error explaining that len()
is not allowed.
Is this a regression? If it is, put the last known working version (or commit) here.
Not a regression
Environment
-Docker Image ID: 109eb1c12738
Suggestions
No response