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

Function qpe

python/tests/kernel/test_sample_kernel.py:66–77  ·  view source on GitHub ↗
(nC: int, nQ: int, statePrep: Callable[[cudaq.qubit], None],
            oracle: Callable[[cudaq.qubit], None])

Source from the content-addressed store, hash-verified

64
65 @cudaq.kernel
66 def qpe(nC: int, nQ: int, statePrep: Callable[[cudaq.qubit], None],
67 oracle: Callable[[cudaq.qubit], None]):
68 q = cudaq.qvector(nC + nQ)
69 countingQubits = q.front(nC)
70 stateRegister = q.back()
71 statePrep(stateRegister)
72 h(countingQubits)
73 for i in range(nC):
74 for j in range(2**i):
75 cudaq.control(oracle, [countingQubits[i]], stateRegister)
76 iqft(countingQubits)
77 mz(countingQubits)
78
79 cudaq.set_random_seed(13)
80 counts = cudaq.sample(qpe, 3, 1, xGate, tGate)

Callers

nothing calls this directly

Calls 8

qvectorMethod · 0.80
iqftFunction · 0.70
hFunction · 0.50
rangeFunction · 0.50
mzFunction · 0.50
frontMethod · 0.45
backMethod · 0.45
controlMethod · 0.45

Tested by

no test coverage detected