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

Function toffoli

python/tests/kernel/test_kernel_features.py:176–181  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

qvectorMethod · 0.80
xFunction · 0.50
frontMethod · 0.45
controlMethod · 0.45

Tested by

no test coverage detected