()
| 174 | |
| 175 | @cudaq.kernel |
| 176 | def toffoli(): |
| 177 | q = cudaq.qvector(3) |
| 178 | ctrl = q.front() |
| 179 | # without a control, apply x to all |
| 180 | x(ctrl, q[2]) |
| 181 | cudaq.control(fancyCnot, [ctrl], q[1], q[2]) |
| 182 | |
| 183 | counts = cudaq.sample(toffoli) |
| 184 | assert len(counts) == 1 |