cuda-quantum
cuda-quantum copied to clipboard
Specify control state
Required prerequisites
- [x] Search the issue tracker to check if your feature has already been mentioned or rejected in other issues.
Describe the feature
This is how to perform controlled operations:
import cudaq
@cudaq.kernel
def x_kernel(qubit: cudaq.qubit):
x(qubit)
@cudaq.kernel
def kernel():
controls = cudaq.qvector(2)
target = cudaq.qubit()
# Default: apply the x_kernel if controls are |1>
cudaq.control(x_kernel, controls, target)
results = cudaq.sample(kernel)
print(cudaq.draw(kernel))
Currently, when the controls = 11
the target is applied.
What if I want to specify the control state for which the target is applied?
I may want to apply the target when the controls = 01
or controls = 00
See here for similar feature in qiskit.