cuda-quantum icon indicating copy to clipboard operation
cuda-quantum copied to clipboard

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

Open poojarao8 opened this issue 10 months ago • 1 comments

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

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

poojarao8 avatar Apr 11 '24 16:04 poojarao8