NVIDIA/cuda-quantum

cudaq.draw drops the last few qubits if no operations on them

poojarao8 opened this issue · 2 comments

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

If there are 5 qubits, and there are no operations done on q3 and q4, then the output it produces only includes q0, q1 and q2 drawings.

Steps to reproduce the bug

import cudaq

@cudaq.kernel
def kernel(N: int):
    q = cudaq.qvector(N)
    h(q[0])
    ry(1.47, q[2])
    x.ctrl(q[1], q[0])
    mz(q)

print(cudaq.draw(kernel, 5))

Expected behavior

Draw a straight line if there are no operations on a qubit.

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

Screenshot of the ouput:
Screenshot 2024-04-11 at 9 51 42 PM