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

Function test_kernel_control_list_args

python/tests/mlir/control.py:195–211  ·  view source on GitHub ↗

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

(qubit_count)

Source from the content-addressed store, hash-verified

193
194@pytest.mark.parametrize("qubit_count", [1, 5])
195def test_kernel_control_list_args(qubit_count):
196 """
197 Tests `Kernel::control()` with another kernel that's
198 parameterized by a list. Test for both a single qubit
199 and a register of qubits as the controls.
200 """
201 other_kernel, other_list = cudaq.make_kernel(list)
202 other_qubit = other_kernel.qalloc()
203 other_kernel.rx(other_list[0], other_qubit)
204
205 kernel, _list = cudaq.make_kernel(list)
206 control_qubit = kernel.qalloc(qubit_count)
207 # Call `kernel.control()`.
208 kernel.control(other_kernel, control_qubit, _list)
209
210 # Check the MLIR.
211 print(kernel)
212
213
214# CHECK-LABEL: test_kernel_control_list_args

Callers

nothing calls this directly

Calls 3

printFunction · 0.50
qallocMethod · 0.45
controlMethod · 0.45

Tested by

no test coverage detected