Support cudaq.qvector for the multi-qubit custom op
Open
@sacpis is already working on this.
Since Mar 16, 2026.
enhancement
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
Extended from ticket https://github.com/NVIDIA/cuda-quantum/issues/1475
Problem
Accepting cudaq.qvector to provide flexibility and convenience for multi-qubit custom op within a kernel.
Description
Now in v0.9.1, error: invalid number of arguments occurs when the code below is executed with cudaq.draw, cudaq.sample, etc:
num_qubits = 2
cudaq.register_operation("custom_op", np.identity(2**num_qubits))
@cudaq.kernel
def kernel(num_qubits: int):
qubits = cudaq.qvector(num_qubits)
custom_op(qubits) # Doesn't work
Then we need to manually pass the qubits (or cudaq.qubit) one by one:
@cudaq.kernel
def kernel(num_qubits: int):
qubits = cudaq.qvector(num_qubits)
custom_op(qubits[0], qubits[1])
Same for the ctrl method if cudaq.qvector is involved:
num_qubits = 2
cudaq.register_operation("custom_op", np.identity(2**num_qubits))
@cudaq.kernel
def kernel(num_qubits: int):
qubits = cudaq.qvector(num_qubits+1)
custom_op.ctrl(qubits[0], qubits[1:3]) # Doesn't work
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.