NVIDIA / NVIDIA/cuda-quantum

Classical bit operations like bit shift and bitand

Open
#2,331 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement python-lang stale-notified
Dominant language
C++
Stars
1.1k
Forks
456
Avg merge
1d 22h
Merged PRs (30d)
165

Description

Required prerequisites
  • Search the issue tracker to check if your feature has already been mentioned or rejected in other issues.
Describe the feature

It would be useful to write code like this.

import cudaq

@cudaq.kernel
def test(num_qubits: int, mask: int):
    q = cudaq.qvector(num_qubits)
    for i in range(num_qubits):
        if mask >> i & 1:
            x(q[i])
    mz(q)

Now I got errors unhandled binary operator - <ast.BitAnd object at 0x7fe9703569b0>.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Python kernel example in the issue and investigate how CUDA Quantum handles binary operators while compiling kernels. Reproduce the reported BitAnd error and determine the expected behavior for bit shifts and bitwise AND; done means the example compiles and executes with those operations supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.