Tests the compilation of the various overloads of `cswap` gates.
()
| 276 | |
| 277 | |
| 278 | def test_ctrl_swap(): |
| 279 | """ |
| 280 | Tests the compilation of the various overloads of `cswap` gates. |
| 281 | """ |
| 282 | kernel = cudaq.make_kernel() |
| 283 | controls_vector = [kernel.qalloc() for _ in range(3)] |
| 284 | controls_register = kernel.qalloc(3) |
| 285 | first = kernel.qalloc() |
| 286 | second = kernel.qalloc() |
| 287 | |
| 288 | kernel.cswap(controls_vector, first, second) |
| 289 | kernel.cswap(controls_register, first, second) |
| 290 | kernel.cswap([controls_vector[0], controls_vector[1], controls_register], |
| 291 | first, second) |
| 292 | |
| 293 | print(kernel) |
| 294 | |
| 295 | |
| 296 | # CHECK-LABEL: test_ctrl_swap |