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)
| 193 | |
| 194 | @pytest.mark.parametrize("qubit_count", [1, 5]) |
| 195 | def 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 |