MCPcopy Create free account
hub / github.com/NVIDIA/cuda-quantum / test_kernel_control_int_args

Function test_kernel_control_int_args

python/tests/mlir/control.py:149–164  ·  view source on GitHub ↗

Tests `Kernel::control()` with another kernel that's parameterized by an int. Test for both a single qubit and a register of qubits as the controls.

(qubit_count)

Source from the content-addressed store, hash-verified

147
148@pytest.mark.parametrize("qubit_count", [1, 5])
149def test_kernel_control_int_args(qubit_count):
150 """
151 Tests `Kernel::control()` with another kernel that's
152 parameterized by an int. Test for both a single qubit
153 and a register of qubits as the controls.
154 """
155 other_kernel, other_int = cudaq.make_kernel(int)
156 other_qubit = other_kernel.qalloc(qubit_count)
157 # TODO:
158 # Would like to be able to test kernel operations that
159 # can accept an int.
160
161 kernel, _int = cudaq.make_kernel(int)
162 control_qubit = kernel.qalloc(qubit_count)
163 kernel.control(other_kernel, control_qubit, _int)
164 print(kernel)
165
166
167# CHECK-LABEL: func.func @__nvqpp__mlirgen__PythonKernelBuilderInstance

Callers

nothing calls this directly

Calls 3

printFunction · 0.50
qallocMethod · 0.45
controlMethod · 0.45

Tested by

no test coverage detected