Tests `Kernel::control()` with another kernel that's parameterized by a float. Test for both a single qubit and a register of qubits as the controls.
(qubit_count)
| 98 | |
| 99 | @pytest.mark.parametrize("qubit_count", [1, 5]) |
| 100 | def test_kernel_control_float_args(qubit_count): |
| 101 | """ |
| 102 | Tests `Kernel::control()` with another kernel that's |
| 103 | parameterized by a float. Test for both a single qubit |
| 104 | and a register of qubits as the controls. |
| 105 | """ |
| 106 | other_kernel, other_float = cudaq.make_kernel(float) |
| 107 | other_qubit = other_kernel.qalloc() |
| 108 | other_kernel.rx(other_float, other_qubit) |
| 109 | |
| 110 | kernel, float_ = cudaq.make_kernel(float) |
| 111 | control_qubit = kernel.qalloc(qubit_count) |
| 112 | # Call `kernel.control()`. |
| 113 | kernel.control(other_kernel, control_qubit, float_) |
| 114 | |
| 115 | # Check the MLIR. |
| 116 | print(kernel) |
| 117 | |
| 118 | |
| 119 | # CHECK-LABEL: func.func @__nvqpp__mlirgen__PythonKernelBuilderInstance |