Skip to content

Negative slice does not work #2930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4 tasks done
ikkoham opened this issue May 20, 2025 · 0 comments · May be fixed by #3022
Open
4 tasks done

Negative slice does not work #2930

ikkoham opened this issue May 20, 2025 · 0 comments · May be fixed by #3022
Assignees

Comments

@ikkoham
Copy link
Contributor

ikkoham commented May 20, 2025

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

Using negative values in slices in Python allows slicing from the tail, but this feature is no longer working.

Steps to reproduce the bug

import cudaq


@cudaq.kernel
def bar():
    qubits = cudaq.qvector(10)
    h(qubits[0:3])
    controls = qubits[0:-1]
    target = qubits[-1]

    x.ctrl(controls, target)


print(cudaq.draw(bar))
print(cudaq.sample(bar))

Image

Expected behavior

Outputs the correct circuit diagram and sampling results.

Is this a regression? If it is, put the last known working version (or commit) here.

CUDA-Q 0.8.0 works

Environment

  • CUDA-Q version: 0.10.0
  • Python version:
  • C++ compiler:
  • Operating system:

I've used the container in NGC.

Suggestions

No response

@sacpis sacpis self-assigned this Jun 9, 2025
@sacpis sacpis linked a pull request Jun 9, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants